Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wildfire breaks uncompyle2 #12

Open
0vercl0k opened this issue May 2, 2013 · 1 comment
Open

wildfire breaks uncompyle2 #12

0vercl0k opened this issue May 2, 2013 · 1 comment
Assignees

Comments

@0vercl0k
Copy link

0vercl0k commented May 2, 2013

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

@ghost ghost assigned Mysterie May 13, 2013
@Mysterie
Copy link
Owner

Hi 0vercl0k,

Thanks for your report! For the moment I'll try to improve the python bytecode reader, and the way error are handled.
But uncompyle2 is a decompilator not a deobfuscator (for the moment), so it won't be a full fix.

If you have time, you can push deobfuscator feature ;D.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants