How to decompile an exe file compiled by py2exe?

How to decompile an exe file compiled by py2exe?

just one exe file, didn'n have any zip file.

how to decompile to pyc or pyo file?

Answers


You can use unpy2exe to extract the .pyc and then use pyREtic to get the source code. 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:

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

thene go to the location of REpdb.py and run:

REpdb.py

set_project [new project name]

Select the python version

fs_um_decompile [location of pyc file]

The source should be in ...\Projects[new project name]\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. pyREtic


I have wrote a small tool in C++ which takes a py2exe generated executable and extracts the PYTHONSCRIPT and Library.zip. The Library.zip contains mostly pyc/pyo files, you can decompile them using any decompiler.

Links :

Py2ExeDumper : https://sourceforge.net/projects/py2exedumper/ Easy Python Decompiler : http://sourceforge.net/projects/easypythondecompiler/


Use script provided here. It requires the original py2exe Python module to be installed. Also you must ensure that you use the same Python version originaly used to produce the executable. Otherwise the script will produce invalid magic number for the .pyc. Later you can use uncompyle2 to restore the original .py source.


Need Your Help

Issue with getting a style setting from javascript

javascript html css

So I am trying to get it so each time a button is pressed a circle gets wider. I have ran into the most peculiar issue, their is a block of code that when you put it in an alert() method it shows

Add BarButtonItem to Navigation Controller in Popover

iphone objective-c ipad

I'm trying to add UIBarButtonItems to a Navigation Controller that is displayed as a popup. I can't seem to add the buttons, and I'm wondering if someone can help me out.