The question didn’t say anything but giving us a python 2.7 byte-compiled file. This can be identified by issuing the file command. As the file says, it’s a compiled binary so you cannot see the sources directly.
By running the python binary, you get an output such:
At the end of the output, the python binary ask for some input. At first I though that it might want me to break the input so that it return true or something. I try to give a format string input but nothing happen.
I also try to give symbols characters, see if it breaks or something.
Then I also try to giving a huge number characters to see if it crash. Seriously, a very huge char. But I didn’t pasted it all here.
All of my small attempts was failure, but I didn’t give up. Reading at the output looks like something the program hides from us. The first interesting line was the long number here:
It might hidden something through a custom encryption in the program. This must be decrypt, it might be the flag! but how? I scroll again the output, it also gives us many LOAD_CONST value. I think that this constant must hold some value but I still don’t know what the number is. Not until I found a line:
It gets me think that this might be the function chr() in python that they use to return a string of a character whose ASCII code is the integer from the LOAD_CONST variable. I try a few of them and it shows something from the LOAD_CONST integer.
And my guess are correct! there must be hold some meaningful value. The variable is too much that I don’t have much time to chr() one by one, so I made a script that can make my job easier. To do that, first I redirect the output to a file, so that I can extract the LOAD_CONST integer value. That would make extraction easier.
By the output.txt, I use awk command to extract the pattern from the file.
Then I simply copy the number variable to a file called chr.txt. Then these number need to be load in a list python so that we can iterate in every integer in that list. I made another script to do that:
By running this script, I get the output:
Hmm.. what is this. Nothing as I expected. So think again, this might not gives a straight hint, but this might help in further digging. I stress out with the python binary I think that I really need to see the source code. I look for online disassembler and I found this! Uncomplye2 is a Python 2.5, 2.6, 2.7 byte-code decompiler that written in Python 2.7. Cool! since our binary is python 2.7 byte-compile file, this might help lead us something. So I clone the repo, install them and run the decompiler. And cool! it works so I have the source code now. It looks like this:
When I see the line below, I know that what the previous steps do. Which is importing some libraries to decrypt the d long unknown variable.
Without further a do, I write a solver script to end this thing. :) (smiles on the face)
Running this script, gives us the flag cost 200 points which is 7h15_15_7o0_345y_f0r_y0u.