We are being presented with the following text.
I wrote you a song. Put it in the picoCTF{} flag format.
First, download the file and read it through. There is a programming language called Rockstar that can be found in the following link.
The song can be found below.
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
Go to the following link and paste the song into the input box.
Now, create a file named file.txt and paste the contents of the output there. Notice that all files must be in the same folder.
114
114
114
111
99
107
110
114
110
48
49
49
51
114
We will write a Python program in order to get the flag. Let's start.
fp = open("file.txt")
rl = fp.readlines()
print(f"Original: {rl}")
ll = []
for i in range(0, len(rl)):
if "\n" in rl[i] and len(rl[i]) == 3:
rl[i] = "0" + rl[i]
ll.append(rl[i].replace("\n", ""))
rs = ' '.join(ll)
print(rs)
def decimal_to_ascii(s):
string_convert = ""
for decimal_char in s.split(" "):
string_convert += chr(int(decimal_char, 10))
return string_convert
print(decimal_to_ascii(rs))
fp.close()
At first, we open up the file and read its contents. Inside a for loop, we loop through the list and check if there is a new line (\n) inside each item and its length is equal to 3. If it is we add a "0" in front of it. We follow this approach because in our file we have a bunch of two digits numbers and they must be in pairs of 3 digits in order for the conversion from base 10 to work.
Finally, we print out the flag and close our file, in order to free up the memory and not consume resources.
Subscribe to our email newsletter and unlock access to members-only content and exclusive updates.
Comments