Skip to content

About

Misc工具 轻松逆向还原python打包exe的python源代码

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

ezreversepython

Misc工具 轻松逆向还原python打包exe的python源代码

使用说明

仅支持windows系统

.\reverse.exe xxx.exe

输出的main.py会保存至output目录下

支持 Python 3.6–3.13

原理

PyInstaller 打包的 exe 本质上是一个自解压归档,内部存储了所有 .pyc 字节码和依赖,pyinstxtractor解析这个归档格式,把文件提取出来。

然后使用了一个基于 AI(Transformer模型)的 Python 字节码反编译器

1. Segmentation — 把字节码指令序列切分成对应源码语句的片段
2. Translation — 用 seq2seq 模型把每个片段翻译成 Python 源码
3. Control Flow Reconstruction — 还原 if/for/while/try 等控制流结构
4. Correction — 对翻译结果做等价性校验和修正

最后生成反编译的python文件落盘于./output下

最后

本项目基于pylingual和pyinstxtractor构建,实现了简化逆向流程,在CTF断网环境下对python打包的exe进行逆向

About

Misc工具 轻松逆向还原python打包exe的python源代码

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages