Description
There is a program running on a server that just outputs some numbers - figure out what they mean.
Setup
Connect via netcat.
nc mercury.picoctf.net 43239Solution
Walk me through it- Step 1Connect and observe the outputConnect to the server. It streams a series of space-separated decimal numbers, then exits.bash
nc mercury.picoctf.net 43239Learn more
netcat (
nc) is a fundamental network utility sometimes called the "Swiss Army knife" of networking. It can open raw TCP or UDP connections to any host and port, and it passes data between your terminal and the remote endpoint with no protocol overhead. Security researchers use it constantly to interact with CTF challenge servers, probe open ports, and debug networked services.When the server streams numbers and then exits, that's a one-shot interaction - the server sends a sequence of decimal integers (each one is an ASCII code for a single character of the flag) and closes the connection. Your job is to read those integers and convert each one back to its character. The same encoding can appear as octal, hexadecimal, or binary in other challenges.
- Step 2Convert decimal values to ASCII charactersEach number is the decimal ASCII code of one character of the flag. Use Python to convert them all at once. Copy the numbers from the output and paste them as a space-separated string.python
python3 -c "output = '<paste numbers here>'; print(''.join([chr(int(x)) for x in output.split()]))"Learn more
ASCII (American Standard Code for Information Interchange) is a 7-bit character encoding that maps integers 0 to 127 to characters. Printable characters occupy 32 to 126: lowercase letters are 97 to 122, uppercase 65 to 90, digits 48 to 57, and common punctuation fills the gaps. Understanding ASCII values is essential for CTF work - you'll encounter them in many forms: decimal, hexadecimal (
0x70=p), octal, and binary.Python's
chr()function converts an integer to its corresponding Unicode character (which is identical to ASCII for values 0 to 127). The inverse isord('p')which returns 112. The one-liner splits the space-separated number string, converts each token to an integer, maps it throughchr(), and joins the results into the flag string.Combining with netcat in one pipeline: You can also pipe netcat's output directly into Python without copy-pasting:
timeout 5 nc mercury.picoctf.net 43239 | python3 -c "import sys; print(''.join(chr(int(x)) for x in sys.stdin.read().split()))"
The
timeout 5prefix bounds the wait at 5 seconds.ncsometimes does not detect the remote close cleanly and will hang forever waiting for more input; the timeout is a defensive guardrail.This kind of pipeline - connecting tools with
|- is a core Unix philosophy skill that makes terminal workflows far more powerful.
Flag
picoCTF{...}
The server streams the flag as space-separated decimal ASCII values.