@[TOC] Python反编译exe
下载工具
1.python国内下载: https://mirrors.huaweicloud.com/python/ 建议使用 3.10一下的版本
2.下载.下载pyinstxtractor,网址: https://github.com/extremecoders-re/pyinstxtractor
3.安装反编译工具uncompyle6:
pip install uncompyle6
模块原网址:https://github.com/rocky/python-uncompyle6
这是github上认可度最好的反编译工具,也是上面pyinstxtractor推荐的工具
反编译流程
-
pyinstxtractor ,将改文件复制到和*.exe同一个目录
python pyinstxtractor.py main.py
得到*.exe_extracted文件夹 找到 软件名.pyc的文件
- 反编译pyc文件
uncompyle6 文件名称.pyc > 反编译后的名称.py
问题点
问题1:
\site-packages\xdis\op_imports.py", line 174, in get_opcode_module return op_imports[canonic_python_version[vers_str]]
出现上述错误,大概是版本不支持
找到Lib/site-packages/xdis/magics.py文件
407行左右
add_canonic_versions(
“3.9 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.13 3.9.0b5+”, “3.9.0beta5”
)
添加自己的版本号,例如:3.9.13
问题2:
Error: uncomple6 requires Python 2.6-3.8
提示uncompyle6只支持2.6 --3.8的版本
可以到dist-packages/uncompyle6/bin/uncompile.py文件里面
找到如下代码:
def main_bin():
if not (sys.version_info[0:2] in ((2, 6), (2, 7), (3, 0),
(3, 1), (3, 2), (3, 3),
(3, 4), (3, 5), (3, 6),
(3, 7), (3, 8), (3, 9)
)):
例如添加3.9版本 (3, 9)