Extracting bytecode out of frozen programs

  • Thread starter David Kraeutmann
  • Start date
D

David Kraeutmann

Hello,
I need to extract the modules/packages out of a frozen script. It was
compiled using Python 2.2.3 and the standard freeze.py.
I managed to get a shell after execution using PYTHONINSPECT=y and find
the start of a module/package using a hex editor (I got the sta, but
these modules don't seem to be importable.
Is there a way of extracting them so they are importable in a python shell?

Regards,
David Kraeutmann
 
M

Martin v. Löwis

Is there a way of extracting them so they are importable in a python shell?

Try imp.get_frozen_object.

Regards,
Martin
 
G

Gabriel Genellina

Try imp.get_frozen_object.

Ouch... this looks better than using ctypes.
get_frozen_object exists at least since 1.5.2, but has never been
documented, and the source code says it's obsolete. Should be documented
now? Any alternative?
 
M

Martin v. Löwis

get_frozen_object exists at least since 1.5.2, but has never been
documented, and the source code says it's obsolete. Should be documented
now? Any alternative?

get_frozen_object has been marked obsolete in 1997. Whether it can be
un-deprecated should be discussed on python-dev; I can't guess the
rationale for deprecating it.

Regards,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top