You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Misc pydisasm fixes
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# Mode: -*- python -*-
|
# Mode: -*- python -*-
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015-2016 by Rocky Bernstein <rb@dustyfeet.com>
|
# Copyright (c) 2015-2016, 2018 by Rocky Bernstein <rb@dustyfeet.com>
|
||||||
#
|
#
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys, os, getopt
|
import sys, os, getopt
|
||||||
@@ -13,16 +13,23 @@ program, ext = os.path.splitext(os.path.basename(__file__))
|
|||||||
|
|
||||||
__doc__ = """
|
__doc__ = """
|
||||||
Usage:
|
Usage:
|
||||||
%s [OPTIONS]... FILE
|
{0} [OPTIONS]... FILE
|
||||||
%s [--help | -h | -V | --version]
|
{0} [--help | -h | -V | --version]
|
||||||
|
|
||||||
|
Disassemble FILE with the instruction mangling that is done to
|
||||||
|
assist uncompyle6 in parsing the instruction stream. For example
|
||||||
|
instructions with variable-length arguments like CALL_FUNCTION and
|
||||||
|
BUILD_LIST have arguement counts appended to the instruction name, and
|
||||||
|
COME_FROM instructions are inserted into the instruction stream.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
{0} foo.pyc
|
{0} foo.pyc
|
||||||
{0} foo.py # same thing as above but find the file
|
{0} foo.py # same thing as above but find the file
|
||||||
{0} foo.pyc bar.pyc # disassemble foo.pyc and bar.pyc
|
{0} foo.pyc bar.pyc # disassemble foo.pyc and bar.pyc
|
||||||
|
|
||||||
|
See also `pydisasm' from the `xdis' package.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-U | --uncompyle6 show instructions with uncompyle6 mangling
|
|
||||||
-V | --version show version and stop
|
-V | --version show version and stop
|
||||||
-h | --help show this message
|
-h | --help show this message
|
||||||
|
|
||||||
@@ -34,8 +41,6 @@ def main():
|
|||||||
Usage_short = """usage: %s FILE...
|
Usage_short = """usage: %s FILE...
|
||||||
Type -h for for full help.""" % program
|
Type -h for for full help.""" % program
|
||||||
|
|
||||||
native = True
|
|
||||||
|
|
||||||
if len(sys.argv) == 1:
|
if len(sys.argv) == 1:
|
||||||
print("No file(s) given", file=sys.stderr)
|
print("No file(s) given", file=sys.stderr)
|
||||||
print(Usage_short, file=sys.stderr)
|
print(Usage_short, file=sys.stderr)
|
||||||
@@ -55,8 +60,6 @@ Type -h for for full help.""" % program
|
|||||||
elif opt in ('-V', '--version'):
|
elif opt in ('-V', '--version'):
|
||||||
print("%s %s" % (program, VERSION))
|
print("%s %s" % (program, VERSION))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
elif opt in ('-U', '--uncompyle6'):
|
|
||||||
native = False
|
|
||||||
else:
|
else:
|
||||||
print(opt)
|
print(opt)
|
||||||
print(Usage_short, file=sys.stderr)
|
print(Usage_short, file=sys.stderr)
|
||||||
@@ -64,7 +67,7 @@ Type -h for for full help.""" % program
|
|||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
if os.path.exists(files[0]):
|
if os.path.exists(files[0]):
|
||||||
disassemble_file(file, sys.stdout, native)
|
disassemble_file(file, sys.stdout)
|
||||||
else:
|
else:
|
||||||
print("Can't read %s - skipping" % files[0],
|
print("Can't read %s - skipping" % files[0],
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
|
Reference in New Issue
Block a user