python -m pip install uncompyle6
- download pyinstallerextractor
Using pyinstxtrator.py, enter the command in cmd (from venv): python pyinstxtractor.py xxx.exe
After successful decompression, a [XXX. Exe] extracted folder will appear in the same path, which contains the main program without any suffix. What we need to decompile is this file, and others are dependent libraries, such as pyz extracted folder. At this point, we may wonder why this file is not a. pyc file? This may be one of the shortcomings of the pyinstxtrator. The main program converted is not in the right format. We need to fix it manually.
If you directly change the suffix of the main file to main.pyc for decompilation, an error will occur.
The reason is that the file header magic number is not aligned, so you need to add magic number. Different python versions of magic number are different.
Compile one by yourself to see how many pyinstaller is required for compiling py files, and modules can be installed with pip.
Hexadecimal view its magic number (C:\Users\Maksim\desktop\1\__pycache__
)
Add magic number at the top.
Source:
Save .pyc file.
Done, the source code is displayed in the terminal (a part of the source code is visible in the screenshot).