How to decompile code from a python module using marshal

3

I'd like to get the bytecode of a module in Python and save it in a pyc with marshal.

Example:

abc

  • test
    • module
  • t2
    • mod2

Then I import abc.test.module and would like to get the bytecode and thus save a pyc from it, from that.

    
asked by anonymous 10.03.2014 / 21:57

1 answer

2

A good but discontinued tool is UnPyc (it supports versions 2.5 and 2.6 of Python). There are reports that this decompiler can recover about 90% from the original file.

There's also Easy Python Decompiler which is based on two decompilers (uncompyle2 and decompyle ++ ). The interesting thing is that it supports from 1.0 to 3.3 of Python.

Also note the py_compile module.

    
11.03.2014 / 02:24