How to decompile an exe file compiled by py2exe?

Chris Lambacher lambacck at computer.org
Mon Sep 26 11:43:55 EDT 2005


On Sat, Sep 24, 2005 at 09:29:30PM +0800, Leo Jay wrote:
> Thanks for all of your replies.
> 
> but my problem is not how to decompile .pyo or .pyc files.
Eventually that is what the problem will become.  hjparser.exe is a python
interpreter that runs a python module that it extracts from itself.  In other
words there are two steps to this.  Step one is to extract the .pyc file that
is embedded in hjparser.exe. The second step is to decompile the .pyc into
something that resembles your original file.

You may have some luck determining how to extract the .pyc file by examining
the source for py2exe, either for the creation of the exe or the exe itself.

-Chris 
> 
> i used py2exe to compile my source file `hjparser.py' into
> `hjparser.exe' and other files. but i deleted the `hjparser.py' file
> by misoperation.(of cause, i tried to recover, but failed)
> 
> I opened the `hjparser.exe' file in UltraEdit(a hex editor), and found
> some partial statements and comments but not complete.
> 
> so, my problem is i'm sure that the source code is in `hjparser.exe'
> but i don't know how to decompile the executable file `hjparser.exe'
> into `hjparser.py',
> i don't care about how to decompile .pyo or .pyc files.
> 
> Thanks
> 
> 
> On 9/24/05, Ivan Voras <ivoras at __yahoo.org__> wrote:
> > It is - py2exe embeds python bytecodes. It seems it does it in the
> > "library.zip" file (if I'm reading
> > http://starship.python.net/crew/theller/moin.cgi/Py2Exe correctly).
> > Bytecode files extracted should be decompilable to something resembling
> > original python code by a python decompiler (quick Googling finds
> > "decompyle": http://www.crazy-compilers.com/).
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> >
> 
> 
> 
> --
> Best Regards,
> Leo Jay
> -- 
> http://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list