PicoCTF: Quantum Scrambler - Walkthrough
Today, weโre diving into the picoCTF challenge: Quantum Scrambler
2025. Letโs break it down step by step.
๐ Challenge Overview
The provided Python script reads the contents of a flag.txt file, where each hex value is converted into a corresponding character to reveal the flag.
๐ Solution
To obtain the flag.txt
file, you need to connect to the server using netcat with the following command:
nc verbal-sleep.picoctf.net 53222 > flag.txt
Once youโve saved the flag.txt, the process to decode the flag is quite simple. The hint suggests using eval()
to convert the flag into a list of strings. Once the list is converted, a second hint directs you to focus only on the outer list, which can be achieved through the function extract_outer_list()
.
def extract_outer_list(array):
return [item for inner in array for item in inner if isinstance(item, str)]
def get_flag():
flag = []
with open('flag.txt', 'r') as file:
flag = file.read()
list_string = eval(flag)
flag = extract_outer_list(list_string)
hex_flag = []
for c in flag:
hex_flag.append(chr(int(c, 16)))
return hex_flag
def main():
flag = get_flag()
print(''.join(flag))
python quantum_scrambler.py
๐ฉ Flag Capture
picoCTF{python_is_weird9ece5f24}
Comments