Giter Site home page Giter Site logo

uncompyle2's People

Contributors

htgoebel avatar jbremer avatar kernelsmith avatar mysterie avatar skyfion avatar supervirus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uncompyle2's Issues

Unable to decompile this simple code

First of all I must admit this decompiler is the best I've ever tested, great readality and debuggable, nice work, guys!
But here is a very simple section that current build can't pass through, I don't know a lof on byte-code, but I believe it's a bug, any question please contact me in: [email protected]

source:

selection = []
allEdges2

def findVerts( selection ):
    allEdges2 = ['AAA', 'BBB', 'CCC']
    templates2 = ['A', 'B', 'C']
    cdEdgeLength2 = [floorMe( e.lower() ) for e in allEdges2]
    for i in range( len( templates2 ) ):
        if cdEdgeLength2[0] == templates2[i] :
            if selection:
                selection.append( e.lower() )

def floorMe( stringX ):
    return stringX

asm:

def findVerts--- This code section failed: ---

0   LOAD_CONST        'AAA'
3   LOAD_CONST        'BBB'
6   LOAD_CONST        'CCC'
9   BUILD_LIST_3      None
12  STORE_FAST        'allEdges2'

15  LOAD_CONST        'A'
18  LOAD_CONST        'B'
21  LOAD_CONST        'C'
24  BUILD_LIST_3      None
27  STORE_FAST        'templates2'

30  BUILD_LIST_0      None
33  LOAD_FAST         'allEdges2'
36  GET_ITER          None
37  FOR_ITER          '62'
40  STORE_FAST        'e'
43  LOAD_GLOBAL       'floorMe'
46  LOAD_FAST         'e'
49  LOAD_ATTR         'lower'
52  CALL_FUNCTION_0   None
55  CALL_FUNCTION_1   None
58  LIST_APPEND       None
59  JUMP_BACK         '37'
62  STORE_FAST        'cdEdgeLength2'

65  SETUP_LOOP        '142'
68  LOAD_GLOBAL       'range'
71  LOAD_GLOBAL       'len'
74  LOAD_FAST         'templates2'
77  CALL_FUNCTION_1   None
80  CALL_FUNCTION_1   None
83  GET_ITER          None
84  FOR_ITER          '141'
87  STORE_FAST        'i'

90  LOAD_FAST         'cdEdgeLength2'
93  LOAD_CONST        0
96  BINARY_SUBSCR     None
97  LOAD_FAST         'templates2'
100 LOAD_FAST         'i'
103 BINARY_SUBSCR     None
104 COMPARE_OP        '=='
107 JUMP_IF_FALSE     '84'

110 LOAD_FAST         'selection'
113 JUMP_IF_FALSE     '138'

116 LOAD_FAST         'selection'
119 LOAD_ATTR         'append'
122 LOAD_FAST         'e'
125 LOAD_ATTR         'lower'
128 CALL_FUNCTION_0   None
131 CALL_FUNCTION_1   None
134 POP_TOP           None
135 JUMP_ABSOLUTE     '138'
138 JUMP_BACK         '84'
141 POP_BLOCK         None
142_0   COME_FROM         '65'

Syntax error at or near `POP_BLOCK' token at offset 141


def floorMe(stringX):
    return stringX

Failure when decompiling a conditional generator, python 2.5

Current version of uncompyle2 fails to handle the following piece of code compiled with Python 2.5:

a=[1,2,3]
b=(1 for i in a if i)

The corresponding bytecode:

  3           0 SETUP_LOOP              29 (to 32)
              3 LOAD_FAST                0 (.0)
        >>    6 FOR_ITER                22 (to 31)
              9 STORE_FAST               1 (i)
             12 LOAD_FAST                1 (i)
             15 JUMP_IF_FALSE            9 (to 27)
             18 POP_TOP             
             19 LOAD_CONST               0 (1)
             22 YIELD_VALUE         
             23 POP_TOP             
             24 JUMP_ABSOLUTE            6
        >>   27 POP_TOP             
             28 JUMP_ABSOLUTE            6
        >>   31 POP_BLOCK           
        >>   32 LOAD_CONST               1 (None)
             35 RETURN_VALUE   

Assembler from uncompyle -a:

0   SETUP_LOOP        '30'
3   LOAD_FAST         '.0'
6   FOR_ITER          '29'
9   STORE_FAST        'i'
12  LOAD_FAST         'i'
15  JUMP_IF_FALSE     '26'
18  LOAD_CONST        1
21  YIELD_VALUE       None
22  POP_TOP           None
23  JUMP_BACK         '6'
26  JUMP_BACK         '6'
29  POP_BLOCK         None
30_0    COME_FROM         '0'
30  LOAD_CONST        None
33  RETURN_VALUE      None

There are 2 issues here:

  • scanner for Python 2.5 is supposed to strip away SETUP_LOOP and POP_BLOCK, but it fails to do it
  • there's no grammar production with double JUMP_BACK

local variable 'n' referenced before assignment

Hi, i got this error when i use uncompyle2:

Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/uncompyle2/init.py", line 203, in main
uncompyle_file(infile, outstream, showasm, showast)
File "/Library/Python/2.7/site-packages/uncompyle2/init.py", line 140, in uncompyle_file
uncompyle(version, co, outstream, showasm, showast)
File "/Library/Python/2.7/site-packages/uncompyle2/init.py", line 102, in uncompyle
tokens, customize = scanner.disassemble(co)
File "/Library/Python/2.7/site-packages/uncompyle2/scanner26.py", line 38, in disassemble
self.code = array('B', co.co_code[:n])
UnboundLocalError: local variable 'n' referenced before assignment

This pyc code is written with python 2.6. Can you help fix this? Thanks

Support for 2.6 .pyc file ?

Hi,

Just tried to uncompile a 2.6 .pyc file and it said me that only 2.7 is supported. The tool is ran under python 2.7 env.

Here is the "suspect" code found :
if version != '2.7':
raise ImportError, "This is a Python %s file! Only Python 2.7 files are supported." % version
#print version

The "magic" of my 2.6 .pyc file is found, but the code upper doesn't handle it.

Is the support for 2.6 abandoned ? Or, should I force the feature to translate the bytecode to 2.7, than decompyle it ?

Cheers,

Phil

wildfire breaks uncompyle2

Hi Mysterie,

Recently I have been playing on with Python bytecodes to do weird stuff for fun, and I just saw the python-compiled file I am generating seem to break uncompyle2.
Here is an example:

overclok@spartacus:/tmp$ git clone https://github.com/Mysterie/uncompyle2.git
Cloning into uncompyle2...
[...]
overclok@spartacus:/tmp$ wget "https://github.com/0vercl0k/stuffz/raw/master/Python's%20internals/wildfired_samples/very_understandable_function.Py273.pyc"
[...]
overclok@spartacus:/tmp$ python2.7 uncompyle2/uncompyle2.py very_understandable_function.Py273.pyc
#2013.05.02 17:59:54 UTC

# Can't uncompyle very_understandable_function.Py273.pyc
Traceback (most recent call last):
  File "/tmp/uncompyle2/uncompyle2/__init__.py", line 209, in main
    uncompyle_file(infile, outstream, showasm, showast)
  File "/tmp/uncompyle2/uncompyle2/__init__.py", line 146, in uncompyle_file
    uncompyle(version, co, outstream, showasm, showast)
  File "/tmp/uncompyle2/uncompyle2/__init__.py", line 131, in uncompyle
    walk.gen_source(ast, customize)
  File "/tmp/uncompyle2/uncompyle2/walker.py", line 1407, in gen_source
    self.print_(self.traverse(ast, isLambda=isLambda))
  File "/tmp/uncompyle2/uncompyle2/walker.py", line 493, in traverse
    self.preorder(node)
  File "/tmp/uncompyle2/uncompyle2/spark.py", line 694, in preorder
    self.preorder(kid)
  File "/tmp/uncompyle2/uncompyle2/spark.py", line 694, in preorder
    self.preorder(kid)
  File "/tmp/uncompyle2/uncompyle2/spark.py", line 694, in preorder
    self.preorder(kid)
  File "/tmp/uncompyle2/uncompyle2/spark.py", line 689, in preorder
    self.default(node)
  File "/tmp/uncompyle2/uncompyle2/walker.py", line 1181, in default
    self.engine(table[key], node)
  File "/tmp/uncompyle2/uncompyle2/walker.py", line 1131, in engine
    self.preorder(node[entry[arg]])
  File "/tmp/uncompyle2/uncompyle2/spark.py", line 687, in preorder
    func(node)
  File "/tmp/uncompyle2/uncompyle2/walker.py", line 879, in n_mkfunc
    self.make_function(node, isLambda=0)
  File "/tmp/uncompyle2/uncompyle2/walker.py", line 1282, in make_function
    code = Code(code, self.scanner, self.currentclass)
  File "/tmp/uncompyle2/uncompyle2/scanner.py", line 60, in __init__
    self._tokens, self._customize = scanner.disassemble(co, classname)
  File "/tmp/uncompyle2/uncompyle2/scanner27.py", line 81, in disassemble
    if names[self.get_argument(i+3)] == 'AssertionError':
IndexError: tuple index out of range
# decompiled 0 files: 0 okay, 1 failed, 0 verify failed
#2013.05.02 17:59:54 UTC

By the way, same problem with the Python 2.6.6 equivalent file available here: https://github.com/0vercl0k/stuffz/raw/master/Python's%20internals/wildfired_samples/very_understandable_function.Py266.pyc
Also, if you want to see how those files are generated, see wildfire.py: https://github.com/0vercl0k/stuffz/blob/master/Python's%20internals/wildfire.py

Feel free to email me if you don't manage to reproduce the Python traceback!

Cheers,
0vercl0k

assert statement not recognized

Code with assert statements gets turned into non valid python code.

$ cat test_assert.py
assert isinstance(1, int)

$ uncompyle2 test_assert.pyc
raise isinstance(1, int) or AssertionError

$ python test_assert_dis.py
Traceback (most recent call last):
File "test_assert_dis.py", line 1, in
raise isinstance(1, int) or AssertionError
TypeError: exceptions must be old-style classes or derived from BaseException, not bool

"bad marshal data (unknown type code)" when invoking on pytest .pyc

There is how to reproduce the issue, with the latest version from the repository:

$ cat stupid_test.py 
def test_dummy():
    assert True
$ py.test -q stupid_test.py                                                                                                      
.
1 passed in 0.01 seconds
$ python2.7 /opt/uncompyle2/scripts/uncompyle2 __pycache__/stupid_test.cpython-27-PYTEST.pyc                                 
#2015.02.14 10:47:50 CET
### Can't uncompyle __pycache__/stupid_test.cpython-27-PYTEST.pyc
Traceback (most recent call last):
  File "/home/lucas/.local/lib/python2.7/site-packages/uncompyle2/__init__.py", line 197, in main
    uncompyle_file(infile, outstream, showasm, showast, deob)
  File "/home/lucas/.local/lib/python2.7/site-packages/uncompyle2/__init__.py", line 129, in uncompyle_file
    version, co = _load_module(filename)
  File "/home/lucas/.local/lib/python2.7/site-packages/uncompyle2/__init__.py", line 77, in _load_module
    co = marshal.load(fp)
ValueError: bad marshal data (unknown type code)
# decompiled 0 files: 0 okay, 1 failed, 0 verify failed
#2015.02.14 10:47:50 CET

Any idea on the root cause and if it could be fixed ?

Not able to uncompile Python 2.5 file

I am running uncompyle2 on Python 2.7 and I am trying to uncompile a python 2.5 file, this is what I get:

uncompyle2 ./test.pyo
#2015.10.07 16:12:08 BST
### Can't uncompyle ./test.pyo
Traceback (most recent call last):
  File "build/bdist.macosx-10.10-x86_64/egg/uncompyle2/__init__.py", line 197, in main
    uncompyle_file(infile, outstream, showasm, showast, deob)
  File "build/bdist.macosx-10.10-x86_64/egg/uncompyle2/__init__.py", line 129, in uncompyle_file
    version, co = _load_module(filename)
  File "build/bdist.macosx-10.10-x86_64/egg/uncompyle2/__init__.py", line 74, in _load_module
    raise ImportError, "This is a Python %s file! Only Python 2.7 files are supported." % version
ImportError: This is a Python 2.5 file! Only Python 2.7 files are supported.
# decompiled 0 files: 0 okay, 1 failed, 0 verify failed
#2015.10.07 16:12:08 BST

Any ideas?

Get error: TypeError: main() takes at most 8 arguments (10 given)

HI, everyone:

I try to install uncompyle2 by using "python setup.py install"

and after that I use "uncompyle2 file.pyc" to decompile.

BUT I got this error:
#2013.12.30 11:26:17 CST

Traceback (most recent call last):
File "/usr/local/bin/uncompyle2", line 166, in
showasm, showast, do_verify, py, deob)
TypeError: main() takes at most 8 arguments (10 given)

My OS is Ubuntu13.10. May anyone offer me some tips to address this problem?

Thanks!!

Failure in decompilation of function call with expression in arguments

Under 2.6.4:

test(a == b == c == 1)

fails to decompile:

ParserError: --- This code section failed: ---

0       LOAD_NAME         'test'
3       LOAD_NAME         'a'
6       LOAD_NAME         'b'
9       DUP_TOP           None
10      ROT_THREE         None
11      COMPARE_OP        '=='
14      JUMP_IF_FALSE     '37'
17      LOAD_NAME         'c'
20      DUP_TOP           None
21      ROT_THREE         None
22      COMPARE_OP        '=='
25_0    COME_FROM         '14'
25      JUMP_IF_FALSE     '37'
28      LOAD_CONST        1
31      COMPARE_OP        '=='
34      JUMP_FORWARD      '39'
37      ROT_TWO           None
38      POP_TOP           None
39_0    COME_FROM         '34'
39      CALL_FUNCTION_1   None
42      POP_TOP           None

Syntax error at or near `COME_FROM' token at offset 25_0

Python 2.5 scanner incorrectly restructures the code after deleting instructions

I believe the following fragment of Scanner25.py is wrong:

            for x in toDel:
                if self.code[x-delta] >= dis.HAVE_ARGUMENT:
                    self.code.pop(x-delta)
                    self.restructCode(x-delta)
                    self.code.pop(x-delta)
                    self.restructCode(x-delta)
                    self.code.pop(x-delta)
                    self.restructCode(x-delta)
                    delta += 3
                else:
                    self.code.pop(x-delta)
                    self.restructCode(x-delta)
                    delta += 1

For 3-byte instructions it tries to restruct the code after each byte removed - thus, if e.g. restructCode is called after the first byte is removed, it will treat second byte of the instruction as opcode.

The call to restructCode() should be done only once, after removing all 3 bytes. However, this means that restructCode() need to know if 1 or 3 bytes were removed.

Can't get uncompyle2 to work on windows 8

Uncompyle2 in scripts folder aint a .py file.
and when i run 'uncompyle2 -h' i get

C:\Program Files (x86)\Console2>uncompile2 -h
Traceback (most recent call last):
File "C:\Python\Python27\Scripts\uncompile2.py", line 55, in
from uncompyle2 import main
File "C:\Python\Python27\Scripts\uncompyle2.py", line 55, in
ImportError: cannot import name main

ive seen this problem on your github error page, but it was closed and marked as error 34 which inturn linked to error 37.

could i get som info on how to solve this?

python 2.6 error

Traceback (most recent call last):
File "uncompyle2.py", line 48, in
from uncompyle2 import main, verify
File "C:\Documents and Settings\ALIAS\My Documents\uncompyle2-master\uncompyle2__init__.py", line 31, in
import walker, verify, magics
File "C:\Documents and Settings\ALIAS\My Documents\uncompyle2-master\uncompyle2\walker.py", line 47, in
import parser
File "C:\Documents and Settings\ALIAS\My Documents\uncompyle2-master\uncompyle2\parser.py", line 15, in
from scanner import Token
File "C:\Documents and Settings\ALIAS\My Documents\uncompyle2-master\uncompyle2\scanner.py", line 15, in
from uncompyle2.opcode import opcode_25, opcode_26, opcode_27
File "C:\Documents and Settings\ALIAS\My Documents\uncompyle2-master\uncompyle2\opcode\opcode_25.py", line 50
globals().update({k.replace('+','_'):v for (k,v) in opmap.items()})
^
SyntaxError: invalid syntax

Python 2.5 support missing?

> python --version
Python 2.7.6

> ./uncompyle2/scripts/uncompyle2 Launchpad.pyc
#2014.06.02 15:40:21 EEST
### Can't uncompyle Launchpad.pyc
Traceback (most recent call last):
  File "/Users/rstets/.pyenv/versions/2.7.6/lib/python2.7/site-packages/uncompyle2/__init__.py", line 197, in main
    uncompyle_file(infile, outstream, showasm, showast, deob)
  File "/Users/rstets/.pyenv/versions/2.7.6/lib/python2.7/site-packages/uncompyle2/__init__.py", line 129, in uncompyle_file
    version, co = _load_module(filename)
  File "/Users/rstets/.pyenv/versions/2.7.6/lib/python2.7/site-packages/uncompyle2/__init__.py", line 74, in _load_module
    raise ImportError, "This is a Python %s file! Only Python 2.7 files are supported." % version
ImportError: This is a Python 2.5 file! Only Python 2.7 files are supported.
# decompiled 0 files: 0 okay, 1 failed, 0 verify failed
#2014.06.02 15:40:21 EEST

unknown magic number 62161

Can't uncompyle routers2.pyc

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/uncompyle2/init.py", line 203, in main
uncompyle_file(infile, outstream, showasm, showast)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/uncompyle2/init.py", line 135, in uncompyle_file
version, co = _load_module(filename)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/uncompyle2/init.py", line 71, in _load_module
raise ImportError, "Unknown magic number %s in %s" % (ord(magic[0])+256*ord(magic[1]), filename)
ImportError: Unknown magic number 62161 in routers2.pyc

decompiled 0 files: 0 okay, 1 failed, 0 verify failed

HOW TO USE UNCOMPYLE2 WINDOWS 8.1

WHEN I TRIED TO UNCOMPYLE PYC FILE.

IT SHOWS AN ERROR LIKE

Embedded file name: /storage/sdcard0/com.hipipal.qpyplus/projects/Simple Server/ServerHandler.py

Traceback (most recent call last):
File "C:\Users\DON OMET HASAN\Downloads\omet.py", line 2, in
uncompyle2.uncompyle_file("ServerHandler.pyc")
File "C:\Python27\lib\site-packages\uncompyle2__init__.py", line 140, in uncompyle_file
uncompyle(version, co, outstream, showasm, showast)
File "C:\Python27\lib\site-packages\uncompyle2__init__.py", line 125, in uncompyle
walk.gen_source(ast, customize)
File "C:\Python27\lib\site-packages\uncompyle2\walker.py", line 1407, in gen_source
self.print_(self.traverse(ast, isLambda=isLambda))
File "C:\Python27\lib\site-packages\uncompyle2\walker.py", line 535, in print_
self.write(*data)
File "C:\Python27\lib\site-packages\uncompyle2\walker.py", line 531, in write
self.f.write(out)
AttributeError: 'NoneType' object has no attribute 'write'

code section failed

pyc file : http://rghost.net/52488840

 #2014.02.17 15:20:44 ora solare Europa occidentale
# Embedded file name: mm_enemy_cooldown.py
--- This code section failed: ---

0   LOAD_CONST        'Minimap enemy cooldown for WOT 0.8.9   + Makct'
3   STORE_NAME        '__doc__'

6   LOAD_CONST        -1
9   LOAD_CONST        None
12  IMPORT_NAME       'BigWorld'
15  STORE_NAME        'BigWorld'

18  LOAD_CONST        -1
21  LOAD_CONST        ('g_windowsManager',)
24  IMPORT_NAME       'gui.WindowsManager'
27  IMPORT_FROM       'g_windowsManager'
30  STORE_NAME        'g_windowsManager'
33  POP_TOP           None

34  LOAD_CONST        -1
37  LOAD_CONST        ('Minimap',)
40  IMPORT_NAME       'gui.Scaleform.Minimap'
43  IMPORT_FROM       'Minimap'
46  STORE_NAME        'Minimap'
49  POP_TOP           None

50  LOAD_CONST        -1
53  LOAD_CONST        ('g_battleContext',)
56  IMPORT_NAME       'gui.BattleContext'
59  IMPORT_FROM       'g_battleContext'
62  STORE_NAME        'g_battleContext'
65  POP_TOP           None

66  LOAD_CONST        -1
69  LOAD_CONST        ('PlayerAvatar',)
72  IMPORT_NAME       'Avatar'
75  IMPORT_FROM       'PlayerAvatar'
78  STORE_NAME        'PlayerAvatar'
81  POP_TOP           None

82  LOAD_CONST        3
85  STORE_NAME        'CALL_BACK_TIME'

88  BUILD_MAP         None
91  STORE_NAME        'minimap_Marks'

94  LOAD_NAME         'PlayerAvatar'
97  LOAD_ATTR         'showTracer'
100 STORE_NAME        'saved_showTracerMakct'

103 LOAD_CONST        '<code_object new_showTracerMakct>'
106 MAKE_FUNCTION_0   None
109 STORE_NAME        'new_showTracerMakct'

112 LOAD_NAME         'new_showTracerMakct'
115 LOAD_NAME         'PlayerAvatar'
118 STORE_ATTR        'showTracer'

121 LOAD_CONST        '<code_object callToHandle>'
124 MAKE_FUNCTION_0   None
127 STORE_NAME        'callToHandle'

130 LOAD_CONST        '<code_object markShooterPositions>'
133 MAKE_FUNCTION_0   None
136 STORE_NAME        'markShooterPositions'

139 LOAD_CONST        '<code_object registerCallBackToDelete>'
142 MAKE_FUNCTION_0   None
145 STORE_NAME        'registerCallBackToDelete'

148 LOAD_CONST        '<code_object removeEntry>'
151 MAKE_FUNCTION_0   None
154 STORE_NAME        'removeEntry'

157 LOAD_CONST        '<code_object addEntryWithMarker>'
160 MAKE_FUNCTION_0   None
163 STORE_NAME        'addEntryWithMarker'

166 LOAD_NAME         'BigWorld'
169 LOAD_NAME         'BigWorld'
172 POP_TOP           None

Syntax error at or near `LOAD_NAME' token at offset 169

# decompiled 0 files: 0 okay, 1 failed, 0 verify failed
#2014.02.17 15:20:44 ora solare Europa occidentale

Code section could not be decompiled

This code section (Python 2.6, I don't have the original source code) could not be decompiled:

def _almostZero--- This code section failed: ---

0   LOAD_FAST         'epsilon'
3   UNARY_NEGATIVE    None
4   LOAD_FAST         'val'
7   DUP_TOP           None
8   ROT_THREE         None
9   COMPARE_OP        '<'
12  JUMP_IF_FALSE     '22'
15  LOAD_FAST         'epsilon'
18  COMPARE_OP        '<'
21  RETURN_END_IF     None
22  ROT_TWO           None
23  POP_TOP           None
24  RETURN_VALUE      None
-1  RETURN_LAST       None

Syntax error at or near `RETURN_END_IF' token at offset 21

I'll sent you a mail with the .pyc.

fails for md5.pyc (wibiti's version works great for same)

Trying this version of uncompyle2,


$ git rev-parse HEAD
09b2adbbbde46ce30d3f1a36c83293572f8b56f0

$ uncompyle2 md5.pyc                     
...
# Can't uncompyle /tmp/md5.pyc
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/uncompyle2/__init__.py", line 203, in main
    uncompyle_file(infile, outstream, showasm, showast)
  File "/usr/lib/python2.7/site-packages/uncompyle2/__init__.py", line 135, in uncompyle_file
    version, co = _load_module(filename)
  File "/usr/lib/python2.7/site-packages/uncompyle2/__init__.py", line 76, in _load_module
    co = dis.marshalLoad(fp)
  File "/usr/lib/python2.7/site-packages/uncompyle2/disas.py", line 193, in marshalLoad
    return load(fp)
  File "/usr/lib/python2.7/site-packages/uncompyle2/disas.py", line 205, in load
    co_argcount = unpack('l', fp.read(4))[0]
error: unpack requires a string argument of length 8
# decompiled 0 files: 0 okay, 1 failed, 0 verify failed

Trying wibiti's version,

$ uncompyle2 md5.pyc         
...
#Embedded file name: md5.py
import warnings
warnings.warn('the md5 module is deprecated; use hashlib instead', DeprecationWarning, 2)
from hashlib import md5
new = md5
blocksize = 1
digest_size = 16
+++ okay decompyling md5.pyc 
# decompiled 1 files: 1 okay, 0 failed, 0 verify failed

URL for the failing file, https://dl.dropboxusercontent.com/u/1522424/md5.pyc

Verify failed

Verify failed with the following error:

#2013.01.17 19:29:37 W. Europe Standard Time
Traceback (most recent call last):
  File "C:\uncompyle2\uncompyle2.py", line 129, in <module>
    result = main(src_base, out_base, files, codes, outfile, showasm, showast, do_verify)
  File "C:\uncompyle2\uncompyle2\__init__.py", line 227, in main
    verify.compare_code_with_srcfile(infile, outfile)
  File "C:\uncompyle2\uncompyle2\verify.py", line 322, in compare_code_with_srcfile
    cmp_code_objects(version, code_obj1, code_obj2)
  File "C:\uncompyle2\uncompyle2\verify.py", line 162, in cmp_code_objects
    scanner = Scanner.getscanner(version)
NameError: global name 'Scanner' is not defined

.pyc per email

"takes most 8 arguments (9 given)" error

2013.03.03 19:49:37 CET
Traceback (most recent call last):
File "/usr/local/bin/uncompyle2", line 163, in
showasm, showast, do_verify, py)
TypeError: main() takes at most 8 arguments (9 given)

whatever the file I want to decompile, i gives this.
the "testpythonlib.py" seems to work but I cannot adapt it to try to decompile my files

any tips ?

if there are many LOAD_CONST in the opcode , it cannot work!

uncompyle2 cli

uncompyle2 --showasm xxx.pyc

...
13665   LOAD_CONST        43190
13668   LOAD_CONST        44321
13671   LOAD_CONST        44322
13674   LOAD_CONST        44333
13677   LOAD_CONST        44334
13680   LOAD_CONST        44337
13683   LOAD_CONST        44442
13686   LOAD_CONST        44443
13689   LOAD_CONST        44818
13692   LOAD_CONST        45000
13695   LOAD_CONST        45054
13698   LOAD_CONST        45678
13701   LOAD_CONST        45966
13704   LOAD_CONST        47000
13707   LOAD_CONST        47557
13710   LOAD_CONST        47624
13713   LOAD_CONST        47806
13716   LOAD_CONST        47808
13719   LOAD_CONST        47891
13722   LOAD_CONST        48000
13725   LOAD_CONST        48001
13728   LOAD_CONST        48002
13731   LOAD_CONST        48003
13734   LOAD_CONST        48556
13737   LOAD_CONST        49400
13740   LOAD_CONST        50000
13743   LOAD_CONST        50001
13746   LOAD_CONST        50002
13749   LOAD_CONST        50003
13752   LOAD_CONST        50004
13755   LOAD_CONST        50013
13758   LOAD_CONST        50123
13761   LOAD_CONST        50505
13764   LOAD_CONST        50776
13767   LOAD_CONST        51051
13770   LOAD_CONST        51210
13773   LOAD_CONST        53001
13776   LOAD_CONST        54320
13779   LOAD_CONST        54321
13782   LOAD_CONST        54345
13785   LOAD_CONST        57341
13788   LOAD_CONST        59595
13791   LOAD_CONST        60008
13794   LOAD_CONST        60177
13797   LOAD_CONST        60179
13800   LOAD_CONST        61439
13803   LOAD_CONST        61440
13806   LOAD_CONST        61441
13809   LOAD_CONST        61446
13812   LOAD_CONST        65000
13815   LOAD_CONST        65301
13818   LOAD_CONST        65534
...

cannot decompile to the source code

uncompyle2 --py -o . xxx.pyc

It will be no responding, and CPU go to 100%, memory also be full filled

2.4 Support?

Hey, not exactly sure where to post this so I figured I'd make an issue. Is 2.4 support planned to be made? I have a project that requires a TON of bytecode to be decompiled, and uncomyple2 has never failed me with 2.7. If this could be available on 2.4, it'd probably be the best decompiler out there.

I have tried decompyle++ and a few others, none of them ever decompile anything as nicely as uncomyple2. If there isn't support for this planned, do you know of any decompilers that'll do the job well?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.