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 15130.

nc jupiter.challenges.picoctf.org 15130

We are being presented with conversion challenges of different formats. Let's dive in!

At first, we are prompted with the following. This means that we have to convert binary data to ASCII text.

πŸ’‘
Please give the 01101100 01100001 01101101 01110000 as a word.

Nice, we have to write a Python program to solve this.

# Binary to ASCII Text
b = "01101100 01100001 01101101 01110000"
b_values = b.split()
print(b_values)

ascii_str = ""
for b_value in b_values:
    t_int = int(b_value, 2)
    ascii_char = chr(t_int)
    ascii_str = ascii_str + ascii_char

print(ascii_str)

At first, we call split() in order to split string on whitespace. Then, we iterate through the loop and convert each binary to a decimal integer. Finally, with the help of chr, we can convert it to an ASCII character.

Let's continue on to the next challenge.

πŸ’‘
Please give me the 146 141 154 143 157 156 as a word.
# Octal to ASCII
octall = "146 141 154 143 157 156"


def octal_to_ascii(s):
    string_convert = ""
    for octal_char in s.split(" "):
        string_convert += chr(int(octal_char, 8))
    return string_convert


print(octal_to_ascii(octall))

This works in a similar way as the above. The only difference is that we need to convert the octal base to ASCII text. Notice, the following line, the second parameter is 8, which is the base for octal.

string_convert += chr(int(octal_char, 8))

Right, we are doing great! Let's see the last challenge.

πŸ’‘
Please give me the 6c697a617264 as a word.

This seems like encoded text. We will need shell probably.

echo '6c697a617264' | xxd -p -r

If you want to lean more about xxd, you can use the manual page. In the terminal just type the following.

man xxd

In a sense, we pass the encoded text and we are doing the reverse of a hexdump, resulting into ASCII text that is in the format that we need.