Pythonexe文件PyInstaller封装程序反编译

内容介绍
PyInstaller封装程序的反编译:

使用PyInstaller Extractor 提取由PyiIstaller生成的可执行文件内容
使用Uncompyle进行反编译
工具准备:
PyInstaller Extractor 项目地址:https://github.com/extremecoders-re/pyinstxtractor
软件版本:
Python 3.7.3
PyInstaller 3.6
PyInstxtractor 2.0
Uncompyle 3.6.4

准备pyinstxtractor.py、Main_cfg_editor.exe文件并在该目录下执行cmd命令

python pyinstxtractor.py Main_cfg_editor.exe
pip install uncompyle
uncompyle6 CV_Annotation2JSON.exe_extracted/CV_Annotation2JSON.pyc > CV_Annotation2JSON.py

uncompyle6 python3.9 报错
Uncompyle6 安装与使用
pip安装
pip install uncompyle6
uncompyle6加上需要反编译的文件参数即可,注意使用-o 选项输出到文件中
uncompyle6 -o test.py test.pyc

错误问题

如使用python 3.9 报错,会报错
Error: uncompyle6 requires Python 2.6-3.8
我们只需要给uncompile包加一个3.9支持
Python39\Lib\site-packages\uncompyle6\bin\uncompile.py

在这里插入图片描述

如果报错为 <class ‘ValueError’>; bad marshal data (unknown type code)
ValueError: bad marshal data (unknown type code)
那么说明咱们得修改自己的pyc文件了

使用NotePad++查看16进制的文件,
https://github.com/chcg/NPP_HexEdit/releases下载HexEditor.dll放在Notepad++\plugins\HexEditor目录下
打开pyc文件使用NotePad++的插件功能选择View in HEX
在这里插入图片描述
打开struct.pyc复制第一行0到7的替换需要编译的pyc文件第一行0到7
在这里插入图片描述
然后重新执行uncompyle6

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值