Uncompyle2

From aldeid
Jump to navigation Jump to search

Description

uncompyle2 converts Python byte-code back into equivalent Python source.

It accepts byte-code from Python version 2.7 only.

Installation

$ git clone https://github.com/wibiti/uncompyle2.git
$ cd uncompyle2/
$ sudo python setup.py install

Usage

Syntax

Usage: uncompyle2 [OPTIONS]... [ FILE | DIR]...

Examples:

uncompyle2      foo.pyc bar.pyc       # decompile foo.pyc, bar.pyc to stdout
uncompyle2 -o . foo.pyc bar.pyc       # decompile to ./foo.dis and ./bar.dis
uncompyle2 -o /tmp /usr/lib/python1.5 # decompile whole library

Options

General options

-o <path>
output decompiled files to this path
if multiple input files are decompiled, the common prefix is stripped from these names and the remainder appended to <path>
uncompyle -o /tmp bla/fasel.pyc bla/foo.pyc
-> /tmp/fasel.dis, /tmp/foo.dis
uncompyle -o /tmp bla/fasel.pyc bar/foo.pyc
-> /tmp/bla/fasel.dis, /tmp/bar/foo.dis
-s
if multiple input files are decompiled, the common prefix is stripped from these names and the remainder appended to <path>
uncompyle -o /tmp /usr/lib/python1.5
-> /tmp/smtplib.dis ... /tmp/lib-tk/FixTk.dis
-c <file>
attempts a disassembly after compiling <file>
-d
do not print timestamps
-m
use multiprocessing
--py
use '.py' extension for generated files
--norecur
don't recurse directories looking for .pyc and .pyo files
--verify
compare generated source with input byte-code
(requires -o)
--help
show this message

Debugging Options

--showasm, -a
include byte-code (disables --verify)
--showast, -t
include AST (abstract syntax tree) (disables --verify)

Example

INCOMPLETE SECTION OR ARTICLE
This section/article is being written and is therefore not complete.
Thank you for your comprehension.

Comments

Keywords: python disassembler decompiler pyc