81571

uncompyle6 raising a parse error while decompile a *.pyc file

Question:

While trying to help a fellow member from this post <a href="https://stackoverflow.com/questions/41407793/decompile-pyc-file-using-uncompyle2/41407984?noredirect=1#comment70021546_41407984" rel="nofollow">Decompile *.pyc file using uncompyle2</a>, i encountered the following error when trying to decompile *.pyc using uncompyle6 , The error is as follows:

File "/usr/local/lib/python2.7/site-packages/uncompyle6/semantics/pysource.py", line 2231, in build_ast raise ParserError(e, tokens) uncompyle6.semantics.parser_error.ParserError: --- This code section failed: --- 2 0 JUMP_ABSOLUTE 120 'to 120' 3 SETUP_WITH 364 'to 370' 6 STOP_CODE 7 JUMP_ABSOLUTE 168 'to 168' 10 SETUP_WITH 22357 'to 22370' 13 LOAD_CONST 2 '' 16 LOAD_CONST 2 '' 19 POP_TOP 20 RETURN_VALUE -1 RETURN_LAST Parse error at or near `SETUP_WITH' instruction at offset 3

Answer1:

You appear to be trying to decompile (decom<em>py</em>le) a piece of arbitrary data. You don't have any <em>valid</em> bytecode there, not for a regular Python interpreter.

JUMP_ABSOLUTE is used to jump back to the start of loops. It is not used with with statements, which is what the SETUP_WITH opcode deals with. The jumps are probably outside the code block and in this case <em>forward</em> rather than back, so uncompile6 is correctly flagging this as invalid.

There is a possibility that the bytecode was <em>obfuscated</em>, where bytecode meaning is altered from their normal positions. Bytecode is just a sequence of bytes, with each byte given a specific meaning (together with operand values). The Dropbox Python interpreter, for example, has altered that table significantly in an attempt to stop the casual curious engineer from looking at their code (pydecompyle6 compensates for this).

Recommend

  • what is parse error: naked expression at top level?
  • Find symbol dependencies in source code [closed]
  • missing parameter name at index 0 {}
  • Treetop basic parsing and regular expression usage
  • How to move again MainActivity after sending the mail?
  • No such module 'Parse' following Parse iOS Swift Quickstart guide
  • Special chars in Amazon S3 keys?
  • How to use : function in H2O ddply, R?
  • Jenkins: could not create Android emulator failed to parse AVD config file
  • How to synchronize two scrollview in Android?
  • how to change api_token column in token guard
  • Aptana 3 remove bundle (jquery)
  • How do I retrieve the user information of a user authenticated with Apache's mod_ldap?
  • Struts 2 TextField Tag with an attribute and no value
  • Uncaught TypeError: $(…).select2 is not a function
  • Element.tagName for python not working
  • Android Google Maps API v2 start navigation
  • Problems installing Yesod for Haskell
  • Copy to all folders batch file?
  • Odoo 10 - Overriding unlink method
  • Unable to install Git-core+svn by MacPorts
  • why xml file does not aligned properly after append the string in beginning and end of the file usin
  • Date Conversion from yyyy-mm-dd to dd-mm-yyyy
  • VSO Build — Response status code does not indicate success: 404 (Not Found)
  • Dialing with Intent.ACTION_CALL stopps at # in phone number
  • C++ and preprocessor macros: variadic type
  • ilmerge with a PFX file
  • Is there a javascript serializer for JSON.Net?
  • Java Scanner input dilemma. Automatically inputs without allowing user to type
  • Master page gives error
  • How do I fake an specific browser client when using Java's Net library?
  • How reduce the height of an mschart by breaking up the y-axis
  • SSO with signing and signature validation doesn't work
  • Perl system calls when running as another user using sudo
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • Can't mass-assign protected attributes when import data from csv file
  • sending mail using smtp is too slow
  • java string with new operator and a literal