Post

PicoCTF: Quantum Scrambler Solution

A step-by-step solution for the PicoCTF Quantum Scrambler challenge.

PicoCTF: Quantum Scrambler Solution

Today, we’re diving into the picoCTF challenge: Quantum Scrambler 2025. Let’s break it down step by step.

alt text

📊 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:

1
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().

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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))
1
 python quantum_scrambler.py

🚩 Flag Capture

1
picoCTF{python_is_weird9ece5f24}
This post is licensed under CC BY 4.0 by the author.