Challenge Description
This is a challenge involving a Python
script. We will likely have to manipulate the script to display the flag in this challenge.
We first download the provided script using wget <link>
. I’ve attached to full script below for reference:
What does the script do?
When we run this program, we are provided with 3 options.
a) Print encouragement
b) Print flag
c) Quit
Options
a
andc
work perfectly when I run the program. But optionb
(print flag) does not.
Fixing the error
Understanding the error
Noticed something in the script attached above? There’s a function named “
print_flag
”. However, when we choose option ‘b
’ when we run the program, the script prints this line instead:Oops! I must have misplaced the print_flag function! Check my source code!
We can run nano serpentine.py
to add the print_flag()
function if the user chooses option b
.
I added the following 2 lines after the elif
statement, and ran the code again.
This allows the script to display the flag correctly when we choose option b
.
Flag
picoCTF{7h3_r04d_l355_7r4v3l3d_8e47d128}