python反编译
.exe → .pyc
工具:
pyinstxtractor
https://github.com/extremecoders-re/pyinstxtractor
https://github.com/countercept/python-exe-unpacker
命令:python pyinstxtractor.py [filename]
转换出来的主程序格式不对,还需要对其进行手动修复。
需要在该文件起始位置加上8个字节的pyc头,由4字节的magic和4字节的时间戳组成,其中magic会因为python版本的不同而不同,有个技巧就是,查看struct文件的magic,直接复制过去,保存为.pyc文件。
.pyc → .py
工具:
uncompyle6 - https://pypi.org/project/uncompyle6/
decompyle3 - https://github.com/rocky/python-decompile3
pycdc - https://github.com/zrax/pycdc
安装:pip install uncompyle6
命令:uncompyle6 [filename].pyc > [output-filename].py