Another Python Game [Rev]
Last updated
Last updated
For this challenge, a Python-compiled executable and a background file are provided to us.
We can confirm that the executable given is a Python-compiled executable by using strings
If strings
reveal strings such as python
or py
, it is a huge giveaway that the executable was compiled using Python, specifically with the pyinstaller
library. Therefore, the source code of the executable can be recovered using pyinstxtractor
. pyinstxtractor
can be downloaded here:
From here, just execute pyinstxtractor.py
followed by the executable given, and it will extract .pyc
files which are compiled bytecode of the source code. Compiled bytecode is a type of intermediary code that a compiler creates by translating source code into bytecode.
As a general rule of thumb, locate the .pyc
file that has the same name as the executable that we received from the challenge. In this case, it will be source.pyc
.
The .pyc
file contains the source code of the executable. However, it is not human-readable as mentioned before, they are compiled bytecode. For this reason, decompyle3
is needed to decompile the bytecode into human-readable code. decompyle3
can be installed through pip
:
Lastly, execute decompyle3
followed by source.pyc
.
Using decompyle3
we managed to recover the source code of the executable!
Reading through the source code, one of the variables is the flag!