1 依赖工具
-
uncompyle6
2 安装
pip install uncompyle6
3 使用语法
uncompyle6 foo.pyc bar.pyc # decompile foo.pyc, bar.pyc to stdout
uncompyle6 -o . foo.pyc bar.pyc # decompile to ./foo.pyc_dis and ./bar.pyc_dis
uncompyle6 -o /tmp /usr/lib/python1.5 # decompile whole library
4 命令选项
-
-o
指定反编译文件的输出路径: if multiple input files are decompiled, the common prefix is stripped from these names and the remainder appended to uncompyle6 -o /tmp bla/fasel.pyc bla/foo.pyc /tmp/fasel.pyc_dis, /tmp/foo.pyc_dis uncompyle6 -o /tmp bla/fasel.pyc bar/foo.pyc /tmp/bla/fasel.pyc_dis, /tmp/bar/foo.pyc_dis uncompyle6 -o /tmp /usr/lib/python1.5 /tmp/smtplib.pyc_dis ... /tmp/lib-tk/FixTk.pyc_dis
-
–compile | -c
在编译指定文件后,执行反编译
-
-d
打印时间戳
-
-p
指定使用处理器的数量
-
-r
在指定文件夹中,以递归的方式获取
.pyc
与.pyo
文件 -
–fragments
使用片段解析器
-
–verify
比较生成的源码与输入的字节码
-
–verify-run
编译生成的源码,运行并检查退出码
-
–syntax-verify
编译生成的源码
-
–linemaps
生成字节码与生成源码之间的行号
-
–encoding
指定生成的源码的编码
-
–help
显示帮助信息
5 使用样例
-
字节码文件:
test.pyc
uncompyle6 -o test.py test.pyc
执行之后,将生成
test.py
源码文件