简体   繁体   English

如何反编译py2exe编译的exe文件?

[英]How to decompile an exe file compiled by py2exe?

How to decompile an exe file compiled by py2exe?如何反编译py2exe编译的exe文件?

just one exe file, didn'n have any zip file.只有一个 exe 文件,没有任何 zip 文件。

how to decompile to pyc or pyo file?如何反编译为 pyc 或 pyo 文件?

You can use unpy2exe to extract the.pyc and then use pyREtic to get the source code.您可以使用unpy2exe提取 .pyc ,然后使用pyREtic获取源代码。 I guess you can read the HOWTO and understand how to use these programs, but basically you go to the location of unpy2exe.py and run:我想你可以阅读 HOWTO 并了解如何使用这些程序,但基本上你 go 到 unpy2exe.py 的位置并运行:

unpy2exe.py [-h] [-o OUTPUT_DIR] [-p PYTHON_VERSION] filename unpy2exe.py [-h] [-o OUTPUT_DIR] [-p PYTHON_VERSION] 文件名

thene go to the location of REpdb.py and run:然后 go 到 REpdb.py 的位置并运行:

REpdb.py REpdb.py

set_project [new project name] set_project [新项目名称]

Select the python version Select python版本

fs_um_decompile [location of pyc file] fs_um_decompile [pyc 文件的位置]

The source should be in...\Projects[new project name]\sourcecode\fs_um\源应该在...\Projects[新项目名称]\sourcecode\fs_um\

Another approach is to take the python byte code dump directly from memory, Immunity Inc published a paper about this subject with a toolkit that takes the bytecode from memory and decompile it to.py source code.另一种方法是直接从 memory 中获取 python 字节码转储,Immunity Inc 发表了一篇关于此主题的论文,其中使用了一个工具包,该工具包从 memory 中获取字节码并反编译源代码。 pyREtic发热的

I have wrote a small tool in C++ which takes a py2exe generated executable and extracts the PYTHONSCRIPT and Library.zip .我在 C++ 中编写了一个小工具,它采用 py2exe 生成的可执行文件并提取PYTHONSCRIPTLibrary.zip The Library.zip contains mostly pyc/pyo files, you can decompile them using any decompiler. Library.zip主要包含 pyc/pyo 文件,您可以使用任何反编译器对其进行反编译。

Links:链接:

Py2ExeDumper : https://sourceforge.net/projects/py2exedumper/ Py2ExeDumperhttps://sourceforge.net/projects/py2exedumper/
Easy Python Decompiler : http://sourceforge.net/projects/easypythondecompiler/ Easy Python 反编译器: http://sourceforge.net/projects/easypythondecompiler/

Use script provided here .使用此处提供的脚本。 It requires the original py2exe Python module to be installed.它需要安装原始的 py2exe Python 模块。 Also you must ensure that you use the same Python version originaly used to produce the executable.此外,您必须确保使用最初用于生成可执行文件的相同 Python 版本。 Otherwise the script will produce invalid magic number for the.pyc.否则脚本将为 .pyc 生成无效的幻数。 Later you can use uncompyle2 to restore the original.py source.稍后您可以使用uncompyle2恢复 original.py 源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM