This writeup is about solving the Nice netcat challenge on picoCTF.
The description tells us that “There is a nice program that you can talk to by using this command in a shell: $ nc mercury.picoctf.net 22902, but it doesn’t speak English…”
So let’s open a terminal window and listen to what that program has to say:
$ nc mercury.picoctf.net 22902
112
105
99
111
67
84
70
123
103
48
48
100
...
Oh, what a bunch of numbers. But what do they mean? Any ideas? They are the ASCII representation of characters. ASCII stands for ‘American Standard Code for Information Interchange’. Fortunately there is a Python command to convert this numbers back to characters. So a small python script will do the whole work for us:
#!/usr/bin/env python3
import sys
for line in sys.stdin:
print(chr(int(line)), end='')
Save the file as decode.py
and set it executable with chmod u+x decode.py
.
All we have to do now is piping the output from netcat to the python script:
$ nc mercury.picoctf.net 22902 | ./decode.py
picoCTF{flag}
Congratulations. You’ve got another flag.