> For the complete documentation index, see [llms.txt](https://codingmace.gitbook.io/masterward/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codingmace.gitbook.io/masterward/ctf/2019/picoctf/general.md).

# General Skills

### Lets Warm Up \[50 pts]

> **Description**
>
> If I told you a word started with 0x70 in hexadecimal, what would it start with in ASCII?

**Solution**

Searched 0x70 to ASCII in search engine

**Flag: picoCTF{p}**

### Warmed Up \[50 pts]

> **Description**
>
> What is 0x3D (base 16) in decimal (base 10)?

**Solution**

Doing this by math we have 3 \* 16^1 + D (13) \* 16^0 = 61

**Flag: picoCTF{61}**

### 2Warm \[50 pts]

> **Description**
>
> Can you convert the number 42 (base 10) to binary (base 2)?

**Solution**

2 ^ 6 = 64 and 2 ^ 5 = 32 which 42 is in that so their are 6 bits for 42. XXXXXX\
42 / 2 = 21 remainder 0\
21 / 2 = 10 remainder 1\
10 / 2 = 5 remainder 0\
5 / 2 = 2 remainder 1\
2 / 2 = 1 remainder 0\
1 / 2 = 0 remainder 1\
So 42 = the remainders above

**Flag: picoCTF{101010}**

### what's a net cat? \[100 pts] <a href="#whats-a-net-cat" id="whats-a-net-cat"></a>

> **Description**
>
> &#x20;Using netcat (nc) is going to be pretty important. Can you connect to `jupiter.challenges.picoctf.org` at port `64287` to get the flag?

**Solution**

I could do the conventional `nc jupiter.challenges.picoctf.org 64287` into the terminal and get the response, but I wanted to do it in some code since not all problems can be solved through terminal.

```python
import sys
import socket

hostname = "jupiter.challenges.picoctf.org"
port = 64287

def netcat(hn , p):
	sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	sock.connect((hn, p))
	while True:
		data = sock.recv(1024)
		if (not data):
			break
		print(data)
	
netcat(hostname, port)
```

**Flag: picoCTF{nEtCat\_Mast3ry\_284be8f7}**

### strings it \[100 pts] <a href="#strings-it" id="strings-it"></a>

> **Description**
>
> Can you find the flag in [file](https://jupiter.challenges.picoctf.org/static/5bd86036f013ac3b9c958499adf3e2e2/strings) without running it?

**Solution**

It gives the hint to not run the file so you can get the flag with 1 command

```bash
$ strings strings | grep "picoCTF"
```

**Flag: picoCTF{5tRIng5\_1T\_827aee91}**

### Bases \[100 pts] <a href="#bases" id="bases"></a>

> **Description**
>
> &#x20;What does this `bDNhcm5fdGgzX3IwcDM1` mean? I think it has something to do with bases.

**Solution**

Just going to go out on a limb and say it is the most common one of base64

```python
import base64
print(base64.b64decode("bDNhcm5fdGgzX3IwcDM1"))
```

**Flag: picoCTF{l3arn\_th3\_r0p35}**

### First Grep \[100 pts] <a href="#first-grep" id="first-grep"></a>

> **Description**
>
> Can you find the flag in [file](https://jupiter.challenges.picoctf.org/static/495d43ee4a2b9f345a4307d053b4d88d/file)? This would be really tedious to look through manually, something tells me there is a better way.

**Solution**

```python
cat file | grep "picoCTF"
```

**Flag: picoCTF{grep\_is\_good\_to\_find\_things\_dba08a45}**

### Based \[200 pts] <a href="#based" id="based"></a>

> **Description**
>
> To get truly 1337, you must understand different data encodings, such as hexadecimal or binary. Can you get the flag from this program to prove you are on the way to becoming 1337? Connect with `nc jupiter.challenges.picoctf.org 29221`.

**Solution**

I connected and the second line was the answer to the first question (Binary). I was then given more numbers which made me choose to write some code for this solution. It was trial and error for most of it but in the end got the solution that it would be decoding in base 2, 8, 16 in that order.

```python
import sys
import socket
import time

hostname = "jupiter.challenges.picoctf.org"
port = 29221

def known_base(a, base):
	res =""
	for unit in a.split(" "):
		try:
			c = chr(int(unit, base))
			if not c.isalpha():
				raise Exception("Non-ascii")
			res += c
		except:
			pass
	return res

def readData(sock, keyWord):
	data = ""
	while True:
		data += sock.recv(2)
		if keyWord in data:
			break
	return data

def cleanData(data):
	start = data.index("the ") + 4
	end = data.index("as a word")
	return data[start:end].strip()	

def netcat(hn , p):
	sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	sock.connect((hn, p))

	data = readData(sock, "Input:")
	sock.recv(1)
	enc_data = cleanData(data)
	myAnswer = known_base(enc_data, 2)
	print("Data given", enc_data)
	print("My Answer" , myAnswer)
	sock.sendall(myAnswer + "\n")
	time.sleep(.1)
	data = readData(sock, "Input:")
	enc_data = cleanData(data)
	myAnswer = known_base(enc_data, 8)
	sock.sendall(myAnswer + "\n")
	print("Data given", enc_data)
	print("My answer", myAnswer)
	time.sleep(.1)
	data = readData(sock, "Input:")
	enc_data = cleanData(data)
	print("Data given", enc_data)
	myAnswer = enc_data.decode('hex')
	print("My answer", myAnswer)
	sock.sendall(myAnswer + "\n")
	print(readData(sock, "}"))
	
netcat(hostname, port)
```

**Flag: picoCTF{learning\_about\_converting\_values\_00a975ff}**

### plumbing \[200 pts] <a href="#plumbing" id="plumbing"></a>

> **Description**
>
> Sometimes you need to handle process data outside of a file. Can you find a way to keep the output from this program and search for the flag? Connect to `jupiter.challenges.picoctf.org 7480`.

**Solution**

It says to keep the output so my mind goes to using '>' onto a file and then using grep to search the file

```python
$ nc jupiter.challenges.picoctf.org 7480 > output.txt
$ cat output.txt | grep "picoCTF"
```

or can combine that all into 1 line

```python
nc jupiter.challenges.picoctf.org 7480 | grep "picoCTF"
```

**Flag: picoCTF{digital\_plumb3r\_06e9d954}**

### mus1c \[300 pts] <a href="#mus-1-c" id="mus-1-c"></a>

> **Description**
>
> I wrote you a [song](https://jupiter.challenges.picoctf.org/static/c594d8d915de0129d92b4c41e25a2313/lyrics.txt). Put it in the picoCTF{} flag format.

**Solution**

I will admit this one would not have been possible without the hint. I looked at the title and was thinking it was an audacity problem but boy was I wrong. \
Hint: Do you think you can master rockstar?\
I searched that on google and of course a lot of writeups came up, but a result after that was a [website ](https://codewithrockstar.com/)to look into. Taking out input&#x20;

> Pico's a CTFFFFFFF my mind is waitin It's waitin\
> Put my mind of Pico into This my flag is not found put This into my flag put my flag into Pico\
> shout Pico shout Pico shout Pico\
> My song's something put Pico into This\
> Knock This down, down, down put This into CTF\
> shout CTF my lyric is nothing Put This without my song into my lyric Knock my lyric down, down, down\
> shout my lyric\
> Put my lyric into This Put my song with This into my lyric Knock my lyric down\
> shout my lyric\
> Build my lyric up, up ,up\
> shout my lyric shout Pico shout It\
> Pico CTF is fun security is important Fun is fun Put security with fun into Pico CTF Build Fun up shout fun times Pico CTF put fun times Pico CTF into my song\
> build it up\
> shout it shout it\
> build it up, up shout it shout Pico

When put in both boxes Rock outputs

> 114\
> 114\
> 114\
> 111\
> 99\
> 107\
> 110\
> 114\
> 110\
> 48\
> 49\
> 49\
> 51\
> 114

Which can be solved by the [website ](https://gchq.github.io/CyberChef/#recipe=From_Decimal\('Line%20feed',false\))to get the flag.

**Flag: picoCTF{rrrocknrn0113r}**

### flag\_shop \[300 pts] \[Not Solved]

> **Description**
>
> There's a flag shop selling stuff, can you buy a flag? [Source](https://jupiter.challenges.picoctf.org/static/64e724ad327f83ad833d9c6baa072b1f/store.c). Connect with `nc jupiter.challenges.picoctf.org 4906`.

**Solution**

a

**Flag:**&#x20;

### 1\_wanna\_b3\_a\_r0ck5tar \[350 pts] <a href="#id-1_wanna_b-3-_a_r-0-ck-5-tar" id="id-1_wanna_b-3-_a_r-0-ck-5-tar"></a>

> **Description**
>
> I wrote you another [song](https://jupiter.challenges.picoctf.org/static/b99c57e4274172bf3c93534b6d59632d/lyrics.txt). Put the flag in the picoCTF{} flag format

**Solution - Not Accepting Flag**

This time I know it will be dealing with rockstar so I was like let's get it and actually downloaded the code trying to understand it more. I did all the installs and ran the file lyrics

```python
Rocknroll is right
Silence is wrong
A guitar is a six-string
Tommy's been down
Music is a billboard-burning razzmatazz!
Listen to the music
If the music is a guitar
Say "Keep on rocking!"
Listen to the rhythm
If the rhythm without Music is nothing
Tommy is rockin guitar
Shout Tommy
Music is amazing sensation
Jamming is awesome presence
Scream Music
Scream Jamming!
Tommy is playing rock
Scream Tommy!
They are dazzled audiences
Shout it!
Rock is electric heaven
Scream it!
Tommy is jukebox god
Say it!
Break it down
Shout "Bring on the rock!"
Else Whisper "That ain't it, Chief"
Break it down
```

Turned into code of this

```python
Rocknroll = True
Silence = False
a_guitar = 10
Tommy = 44
Music = 170
the_music = input()
if the_music == a_guitar:
    print("Keep on rocking!")
    the_rhythm = input()
    if the_rhythm - Music == False:
        Tommy = 66
        print(Tommy!)
        Music = 79
        Jamming = 78
        print(Music!)
        print(Jamming!)
        Tommy = 74
        print(Tommy!)
        They are dazzled audiences
        print(it!)
        Rock = 86
        print(it!)
        Tommy = 73
        print(it!)
        break
        print("Bring on the rock!")
        Else print("That ain't it, Chief")
        break

```

I noticed it didn't look right at all. At this point, I could have just said let me take the numbers and convert myself `66 79 78 74 86 73` == BONJVI, but why was it not working.\
1\. I removed the ! from print statements\
2\. Removed line 19 as it didn't mean anything and 20 as it wasn't assigned\
3\. Matched types on lines 7 and 10 (Had to do manually in code)\
4\. Removed 25 - 28 as they aren't useful in our evaluation\
5\. Replaced 22 with Rock and 24 with Tommy

Final Results: \
Lyrics

> Rocknroll is right\
> Silence is wrong\
> A guitar is a six-string\
> Tommy's been down\
> Music is a billboard-burning razzmatazz!\
> Listen to the music\
> If the music is a guitar\
> Say "Keep on rocking!"\
> Listen to the rhythm\
> If the rhythm without Music is nothing\
> Tommy is rockin guitar\
> Shout Tommy\
> Music is amazing sensation\
> Jamming is awesome presence\
> Scream Music\
> Scream Jamming\
> Tommy is playing rock\
> Scream Tommy\
> Rock is electric heaven\
> Scream Rock\
> Tommy is jukebox god\
> Say Tommy

Final Code

```python
Rocknroll = True
Silence = False
a_guitar = 10
Tommy = 44
Music = 170
the_music = input()
if int(the_music) == a_guitar:
    print("Keep on rocking!")
    the_rhythm = input()
    if int(the_rhythm) - Music == 0:
        Tommy = 66
        print(Tommy)
        Music = 79
        Jamming = 78
        print(Music)
        print(Jamming)
        Tommy = 74
        print(Tommy)
        Rock = 86
        print(Rock)
        Tommy = 73
        print(Tommy)
```

Output with input being 10 and 170

```python
10
Keep on rocking!
170
66
79
78
74
86
73
```

**Flag: picoCTF{BONJVI}**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://codingmace.gitbook.io/masterward/ctf/2019/picoctf/general.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
