How to decompile code from a python module using marshal?

Asked

Viewed 607 times

3

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

Example:

abc

  • test
    • module
  • t2
    • mod2

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

  • See if this can help you. It’s a Python decompiler: https://github.com/wibiti/uncompyle2

  • @Samirbraga uncompyle leaves many poorly decompiled and incomplete files

1 answer

2


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

There is also the Easy Python Decompiler which is based on two decompilers(uncompyle2 and decompyle++). The interesting thing is that it supports from the version 1.0 until the 3.3 python.

Also pay attention to the module py_compile.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.