Git Product home page Git Product logo

python-decompile3's Introduction

TravisCI CircleCI PyPI Installs

decompyle3

A native Python cross-version decompiler and fragment decompiler. A reworking of uncompyle6.

Introduction

decompyle3 translates Python bytecode back into equivalent Python source code. It accepts bytecodes from Python version 3.7 on.

For decompilation of older Python bytecode see uncompyle6.

Why this?

Uncompyle6 is awesome, but it has a fundamental problem in the way it handles control flow. In the early days of Python when there was little optimization and code was generated in a very template-oriented way, figuring out control flow-structures could be done by simply looking at code patterns.

Over the years more code optimization, specifically around handling jumps has made it harder to support detecting control flow strictly from code patterns. This was noticed as far back as Python 2.4 (2004) but since this is a difficult problem, so far it hasn't been tackled in a satisfactory way.

The initial attempt to fix to this problem was to add markers in the instruction stream, initially this was a COME_FROM instruction, and then use that in pattern detection.

Over the years, I've extended that to be more specific, so COME_FROM_LOOP and COME_FROM_WITH were added. And I added checks at grammar-reduce time to make try to make sure jumps match with supposed COME_FROM targets.

However all of this is complicated, not robust, has greatly slowed down deparsing and is not really tenable.

So in this project we started rewriting and refactoring the grammar.

However it is clear that even this isn't enough. Control flow needs to be addressed by using dominators and reverse-dominators which the python-control-flow project can give.

This I am finally slowly doing in yet another non-public project. It is a lot of work. Funding in the form of sponsorhip while greatly appreciated isn't commensurate with the amount of effort, and currently I have a full-time job. So it may take time before it is available publicly, if at all.

Requirements

The code here can be run on Python versions 3.7 or 3.8. The bytecode files it can read have been tested on Python bytecodes from versions 3.7 and 3.8.

Installation

You can install from PyPI using the name decompyle3:

pip install decompyle3

To install from source code, this project uses setup.py, so it follows the standard Python routine:

$ pip install -e .  # set up to run from source tree

or:

$ python setup.py install # may need sudo

A GNU Makefile is also provided so make install (possibly as root or sudo) will do the steps above.

Running Tests

make check

A GNU makefile has been added to smooth over setting running the right command, and running tests from fastest to slowest.

If you have remake installed, you can see the list of all tasks including tests via remake --tasks

Usage

Run

$ decompyle3 *compiled-python-file-pyc-or-pyo*

For usage help:

$ decompyle3 -h

Verification

If you want Python syntax verification of the correctness of the decompilation process, add the --syntax-verify option. However since Python syntax changes, you should use this option if the bytecode is the right bytecode for the Python interpreter that will be checking the syntax.

You can also cross compare the results with another python decompiler like unpyc37 . Since they work differently, bugs here often aren't in that, and vice versa.

There is an interesting class of these programs that is readily available give stronger verification: those programs that when run test themselves. Our test suite includes these.

And Python comes with another a set of programs like this: its test suite for the standard library. We have some code in test/stdlib to facilitate this kind of checking too.

Known Bugs/Restrictions

We support only released versions, not candidate versions. Note however that the magic of a released version is usually the same as the last candidate version prior to release.

We also don't handle PJOrion or otherwise obfuscated code. For PJOrion try: PJOrion Deobfuscator to unscramble the bytecode to get valid bytecode before trying this tool; pydecipher might help with that.

This program can't decompile Microsoft Windows EXE files created by Py2EXE, although we can probably decompile the code after you extract the bytecode properly. Pydeinstaller may help with unpacking Pyinstaller bundlers.

Handling pathologically long lists of expressions or statements is slow. We don't handle Cython or MicroPython which don't use bytecode.

There are numerous bugs in decompilation. And that's true for every other CPython decompiler I have encountered, even the ones that claimed to be "perfect" on some particular version like 2.4.

As Python progresses decompilation also gets harder because the compilation is more sophisticated and the language itself is more sophisticated. I suspect that attempts there will be fewer ad-hoc attempts like unpyc37 (which is based on a 3.3 decompiler) simply because it is harder to do so. The good news, at least from my standpoint, is that I think I understand what's needed to address the problems in a more robust way. But right now until such time as project is better funded, I do not intend to make any serious effort to support Python versions 3.8 or 3.9, including bugs that might come in. I imagine at some point I may be interested in it.

You can easily find bugs by running the tests against the standard test suite that Python uses to check itself. At any given time, there are dozens of known problems that are pretty well isolated and that could be solved if one were to put in the time to do so. The problem is that there aren't that many people who have been working on bug fixing.

You may run across a bug, that you want to report. Please do so. But be aware that it might not get my attention for a while. If you sponsor or support the project in some way, I'll prioritize your issues above the queue of other things I might be doing instead.

See Also

python-decompile3's People

Contributors

byehack avatar cclauss avatar fantasquex avatar graingert avatar graysuit avatar grkov90 avatar hashkitten avatar htgoebel avatar jbremer avatar jlugjb avatar kernelsmith avatar lelicopter avatar moagstar avatar msm-code avatar mysterie avatar pernat1y avatar rocky avatar skyfion avatar supervirus avatar svenskithesource avatar tey avatar thedrow avatar wangym5106 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

python-decompile3's Issues

Tree transformation phase is not adding semantic function customization rules.

Consider this program taken for 01_fstring.py:

def _repr_fn(fields):
    return testit('__repr__',
                  ('self',),
                  ['return xx + f"(' +
                   ', '.join([f"{f}={{self.{f}!r}}"
                              for f in fields]) +
                   ')"'])

Pre commmit 1aa6f00 this was not decompiing properly because there was no semantic rule for CALL_METHOD_1 so the testit call (, ') and,` disappear.

If you uncomment out 1aa6f00#diff-1d363324084c476e417a8c8da17df69cR410 you will see CALL_METHOD_1 appearing in customize the set of semantic action rules that need to be customized.

However if you now uncomment the code that starts at 1aa6f00#diff-02b4d783e57c0af1f6663933c6f45599R2321 you will see that all of this disappears.

So something in doing the tree transformation is not adding the customization and/or prevents the non transform pass from adding it.

Conceptually, I understand why this might be: the first filter pass might not fully traverse the ast tree and follow all code that gets generated. However it might also a problem of removing as well as not adding. There are places like 1aa6f00#diff-1d363324084c476e417a8c8da17df69cR413 which do remove customization items.

@x0ret Would you look at this? If you don't have time or don't want to let me know and I will fix when I get a chance. Thanks!

Redo options processing using click

Description

Command-line options would be simplified if click were used.

Background

Because uncompyle6 has a lot of backward compatibility baggage in running on old Python versions, click is not used in options processing. Here we don't have that limitation.

Python 3.8 - COME_FROM parse error.

Description

Decompile fails because of a parse error.
"Parse error at or near `COME_FROM' instruction at offset 20_0"
Bytecode is able to be properly disassembled.

How to Reproduce

$ decompyle3 decompyle3 -o . <attached file>.pyc
Instruction context:

 L. 269        14  LOAD_FAST                'tile'
                  16  LOAD_ATTR                unit
                  18  POP_JUMP_IF_FALSE_BACK     4  'to 4'
->              20_0  COME_FROM            12  '12'


# file RiftWizard.pyc
# --- This code section failed: ---

 L. 269         0  BUILD_LIST_0          0
                2  LOAD_FAST                '.0'
              4_0  COME_FROM            44  '44'
              4_1  COME_FROM            30  '30'
              4_2  COME_FROM            18  '18'
                4  FOR_ITER             46  'to 46'

 L. 269         6  STORE_FAST               'tile'

 L. 269         8  LOAD_FAST                'tile'
               10  LOAD_ATTR                prop
               12  POP_JUMP_IF_TRUE     20  'to 20'

 L. 269        14  LOAD_FAST                'tile'
               16  LOAD_ATTR                unit
               18  POP_JUMP_IF_FALSE_BACK     4  'to 4'
             20_0  COME_FROM            12  '12'

 L. 269        20  LOAD_FAST                'tile'
               22  LOAD_ATTR                unit
               24  LOAD_DEREF               'self'
               26  LOAD_ATTR                caster
               28  COMPARE_OP               !=
               30  POP_JUMP_IF_FALSE_BACK     4  'to 4'

 L. 269        32  LOAD_FAST                'tile'
               34  LOAD_ATTR                unit
               36  JUMP_IF_TRUE_OR_POP    42  'to 42'
               38  LOAD_FAST                'tile'
               40  LOAD_ATTR                prop
             42_0  COME_FROM            36  '36'
               42  LIST_APPEND           2  ''
               44  JUMP_BACK             4  'to 4'
             46_0  COME_FROM             4  '4'
               46  RETURN_VALUE
               -1  RETURN_LAST

Parse error at or near `COME_FROM' instruction at offset 20_0

Files

Bytecode: https://drive.google.com/file/d/1I_o6sQfxoox3YeDLBp9QBNeX6xo4G6ma/view?usp=sharing
Disassembly: https://drive.google.com/file/d/1-MGh-GSLT5ApCfleigsvEDysYBDRG44x/view?usp=sharing

Environment

Decompyle3 Version: 3.7.7
Python Version: 3.8.0
OS: Windows 10

Deparsing stopped due to parse error

login.zip
When I decompile this file๏ผŒ It shows๏ผš
Instruction context:

L. 108 198 POP_BLOCK
200 LOAD_CONST False
202 RETURN_VALUE
-> 204_0 COME_FROM 182 '182'

file login.pyc

Deparsing stopped due to parse error

login.pyc --

decompile failed

I get an the end a error code named Parse error at or near END_FINALLY instruction at offset 3124

my python version is 3.8 and I got the pyc decompiled from a exe with python-to-exe than I added the magic number.

here is another info may be needed:

OS : win 10
Python 3.8.5
deompile3: newest version right now
Python bytecode 3.8 (3413)
Source code size mod 2**32

issue : I get an the end a error code named Parse error at or near END_FINALLY instruction at offset 3124.

The first picture is when it starts
the second is the error
the 3 thing is the File I try to get the source of
vmware_YEhLGsUoDQ
vmware_MQKIx8uY21

This is the the thing I tired to get the source of: https://anonfiles.com/fd33Dcy6r6/Nighty_pyc

run with error

Traceback (most recent call last):
  File "/usr/local/bin/decompyle3", line 33, in <module>
    sys.exit(load_entry_point('decompyle3==3.3.2', 'console_scripts', 'decompyle3')())
  File "/usr/local/bin/decompyle3", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/local/lib/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/local/lib/python3.8/site-packages/decompyle3-3.3.2-py3.8.egg/decompyle3/__init__.py", line 48, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/local/lib/python3.8/site-packages/decompyle3-3.3.2-py3.8.egg/decompyle3/semantics/pysource.py", line 139, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/local/lib/python3.8/site-packages/decompyle3-3.3.2-py3.8.egg/decompyle3/parsers/__init__.py", line 13, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/local/lib/python3.8/site-packages/decompyle3-3.3.2-py3.8.egg/decompyle3/parsers/treenode.py", line 2, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/local/lib/python3.8/site-packages/decompyle3-3.3.2-py3.8.egg/decompyle3/scanners/tok.py", line 201, in <module>
  File "/usr/local/lib/python3.8/site-packages/decompyle3-3.3.2-py3.8.egg/decompyle3/scanners/tok.py", line 83, in __init__
  File "/usr/local/lib/python3.8/site-packages/xdis/std.py", line 220, in <module>
    _std_api = make_std_api()
  File "/usr/local/lib/python3.8/site-packages/xdis/std.py", line 218, in make_std_api
    return _StdApi(python_version, variant)
  File "/usr/local/lib/python3.8/site-packages/xdis/std.py", line 73, in __init__
    self.opc = opc = get_opcode_module(python_version, variant)
  File "/usr/local/lib/python3.8/site-packages/xdis/op_imports.py", line 170, in get_opcode_module
    return op_imports[canonic_python_version[vers_str]]
KeyError: '3.8.7'
[root@py38 ~]# python3 -V

Another Parse error at or near `RETURN_VALUE' instruction (Python 3.8)

When I decompiled the pyc, got the same error messages as last issue. I had the source code & the script was quite short.
Could you please help to check the issue.
Thanks.

Environment:
Win10 with Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)] on win32

Reproduce the error:
D:\TEST000_pycache>c:Scripts\decompyle3.exe ip.cpython-38.pyc
# decompyle3 version 3.3.2
# Python bytecode 3.8 (3413)
# Decompiled from: Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)]
# Embedded file name: ip.py
# Compiled at: 2020-07-03 14:30:06
# Size of source mod 2**32: 267 bytes
Instruction context:

L. 5 12 POP_BLOCK
14 LOAD_CONST True
-> 16 RETURN_VALUE
18_0 COME_FROM_FINALLY 0 '0'
import ipaddress

def is_ip_Valid--- This code section failed: ---

L. 3 0 SETUP_FINALLY 18 'to 18'

L. 4 2 LOAD_GLOBAL ipaddress
4 LOAD_METHOD ip_address
6 LOAD_FAST 'ipaddr'
8 CALL_METHOD_1 1 ''
10 POP_TOP

L. 5 12 POP_BLOCK
14 LOAD_CONST True
16 RETURN_VALUE
18_0 COME_FROM_FINALLY 0 '0'

L. 6 18 POP_TOP
20 POP_TOP
22 POP_TOP

L. 7 24 POP_EXCEPT
26 LOAD_CONST False
28 RETURN_VALUE
30 END_FINALLY

Parse error at or near `RETURN_VALUE' instruction at offset 16

if name == 'main':
print(is_ip_Valid('2001:db8::'))
print(is_ip_Valid('192.168.168.1'))

# file ip.cpython-38.pyc
# Deparsing stopped due to parse error

Source code:
ip.py.txt
Zipped compiled code:
ip.cpython-38.pyc.zip

Parse error at or near `END_FINALLY' instruction

my python version is 3.8 and compiled code and my pyc file generated with python 3.8

here is another info may be needed:

OS : win 10
Python 3.8.6
uncompyle6 : 3.7.4
decompyle3 : 3.3.2
Python bytecode 3.8 (3413)
Source code size mod 2**32

issue : Parse error at or near END_FINALLY instruction ,I get this Error in any END_FINALLY instruction.

i uploaded myfiles .

PYC.zip
decompile3_outPut.zip

3.8 "breaks" are broken

Used honest-come-froms branch

Expected Script

x = 3
while True:
    try:
        print(4 / x)
        x -= 1
    except Exception:
        break

Bytecode

550d 0d0a 0000 0000 dcd2 dd5d 6a00 0000
e300 0000 0000 0000 0000 0000 0000 0000
0008 0000 0040 0000 0073 3c00 0000 6400
5a00 7a18 6501 6401 6500 1b00 8301 0100
6500 6402 3800 5a00 5700 7104 0400 6502
6b0a 7234 0100 0100 0100 5900 7138 5900
7104 5800 7104 6403 5300 2904 e903 0000
00e9 0400 0000 e901 0000 004e 2903 da01
78da 0570 7269 6e74 da09 4578 6365 7074
696f 6ea9 0072 0700 0000 7207 0000 007a
0774 6573 742e 7079 da08 3c6d 6f64 756c
653e 0100 0000 730a 0000 0004 0202 010c
010c 010e 01

Console Output

C:\Users\JohnHupperts\Desktop\Python Projects\Experiments\testdecompiles\dist\test\test.exe_extracted>decompyle3 test.pyc
# decompyle3 version 3.3.2
# Python bytecode 3.8 (3413)
# Decompiled from: Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)]
# Embedded file name: test.py
# Size of source mod 2**32: 106 bytes
Instruction context:

   7      44  POP_EXCEPT
             46  JUMP_ABSOLUTE        56  'to 56'
->           48  POP_EXCEPT
             50  JUMP_BACK             4  'to 4'
           52_0  COME_FROM            36  '36'
             52  END_FINALLY
             54  JUMP_BACK             4  'to 4'


# file test.pyc
# --- This code section failed: ---

   1       0  LOAD_CONST               3
           2  STORE_NAME               x

   3       4  SETUP_FINALLY        30  'to 30'

   4       6  LOAD_NAME                print
           8  LOAD_CONST               4
          10  LOAD_NAME                x
          12  BINARY_TRUE_DIVIDE
          14  CALL_FUNCTION_1       1  ''
          16  POP_TOP

   5      18  LOAD_NAME                x
          20  LOAD_CONST               1
          22  INPLACE_SUBTRACT
          24  STORE_NAME               x
          26  POP_BLOCK
          28  JUMP_BACK             4  'to 4'
        30_0  COME_FROM_FINALLY     4  '4'

   6      30  DUP_TOP
          32  LOAD_NAME                Exception
          34  COMPARE_OP               exception-match
          36  POP_JUMP_IF_FALSE    52  'to 52'
          38  POP_TOP
          40  POP_TOP
          42  POP_TOP

   7      44  POP_EXCEPT
          46  JUMP_ABSOLUTE        56  'to 56'
          48  POP_EXCEPT
          50  JUMP_BACK             4  'to 4'
        52_0  COME_FROM            36  '36'
          52  END_FINALLY
          54  JUMP_BACK             4  'to 4'
        56_0  COME_FROM_EXCEPT_CLAUSE    46  '46'

Parse error at or near `POP_EXCEPT' instruction at offset 48

Environment

Windows 10, Python 3.8, decompyle3 - latest version

Parse error at or near `DUP_TOP' (python 3.8)

When I decompiled the pyc, got the following error messages.

OS : win 10
Python 3.8.6
uncompyle6 : 3.7.4
decompyle3 : 3.3.2
pydisasm version 5.0.4
Python bytecode 3.8 (3413)
Source code size mod 2**32


Instruction context:

 L.   5        52  LOAD_NAME                list
                  54  LOAD_GENEXPR             '<code_object <genexpr>>'
                  56  LOAD_STR                 '<genexpr>'
                  58  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
                  60  LOAD_GENEXPR             '<code_object <genexpr>>'
                  62  LOAD_STR                 '<genexpr>'
                  64  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
                  66  LOAD_NAME                f_in
                  68  GET_ITER
                  70  CALL_FUNCTION_1       1  ''
                  72  GET_ITER
                  74  CALL_FUNCTION_1       1  ''
                  76  CALL_FUNCTION_1       1  ''
                  78  STORE_NAME               requirements
                  80  POP_BLOCK
                  82  LOAD_CONST               None
->                84  DUP_TOP
                  86  DUP_TOP
                  88  CALL_FUNCTION_3       3  ''
                  90  POP_TOP
                  92  JUMP_FORWARD        110  'to 110'
                94_0  COME_FROM_WITH       48  '48'
                  94  <49>
                  96  POP_JUMP_IF_TRUE    100  'to 100'
                  98  <48>
               100_0  COME_FROM            96  '96'
                 100  POP_TOP
                 102  POP_TOP
                 104  POP_TOP
                 106  POP_EXCEPT
                 108  POP_TOP
               110_0  COME_FROM            92  '92'


# file start.pyc
# --- This code section failed: ---

 L.   2         0  LOAD_CONST               0
                2  LOAD_CONST               None
                4  IMPORT_NAME              re
                6  STORE_NAME               re
                8  LOAD_CONST               0
               10  LOAD_CONST               None
               12  IMPORT_NAME              os
               14  STORE_NAME               os
               16  LOAD_CONST               0
               18  LOAD_CONST               None
               20  IMPORT_NAME              sys
               22  STORE_NAME               sys
               24  LOAD_CONST               0
               26  LOAD_CONST               None
               28  IMPORT_NAME              pkg_resources
               30  STORE_NAME               pkg_resources
               32  LOAD_CONST               0
               34  LOAD_CONST               None
               36  IMPORT_NAME              random
               38  STORE_NAME               random

 L.   3        40  SETUP_FINALLY       228  'to 228'

 L.   4        42  LOAD_NAME                open
               44  LOAD_STR                 'requirements.txt'
               46  CALL_FUNCTION_1       1  ''
               48  SETUP_WITH           94  'to 94'
               50  STORE_NAME               f_in

 L.   5        52  LOAD_NAME                list
               54  LOAD_GENEXPR             '<code_object <genexpr>>'
               56  LOAD_STR                 '<genexpr>'
               58  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
               60  LOAD_GENEXPR             '<code_object <genexpr>>'
               62  LOAD_STR                 '<genexpr>'
               64  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
               66  LOAD_NAME                f_in
               68  GET_ITER
               70  CALL_FUNCTION_1       1  ''
               72  GET_ITER
               74  CALL_FUNCTION_1       1  ''
               76  CALL_FUNCTION_1       1  ''
               78  STORE_NAME               requirements
               80  POP_BLOCK
               82  LOAD_CONST               None
               84  DUP_TOP
               86  DUP_TOP
               88  CALL_FUNCTION_3       3  ''
               90  POP_TOP
               92  JUMP_FORWARD        110  'to 110'
             94_0  COME_FROM_WITH       48  '48'
               94  <49>
               96  POP_JUMP_IF_TRUE    100  'to 100'
               98  <48>
            100_0  COME_FROM            96  '96'
              100  POP_TOP
              102  POP_TOP
              104  POP_TOP
              106  POP_EXCEPT
              108  POP_TOP
            110_0  COME_FROM            92  '92'

 L.   6       110  LOAD_NAME                requirements
              112  GET_ITER
            114_0  COME_FROM           222  '222'
            114_1  COME_FROM           210  '210'
            114_2  COME_FROM           132  '132'
              114  FOR_ITER            224  'to 224'
              116  STORE_NAME               require

 L.   7       118  SETUP_FINALLY       134  'to 134'

 L.   8       120  LOAD_NAME                pkg_resources
              122  LOAD_METHOD              require
              124  LOAD_NAME                require
              126  CALL_METHOD_1         1  ''
              128  POP_TOP
              130  POP_BLOCK
              132  JUMP_BACK           114  'to 114'
            134_0  COME_FROM_FINALLY   118  '118'

 L.   9       134  DUP_TOP
              136  LOAD_NAME                Exception
              138  <121>               220  ''
              140  POP_TOP
              142  STORE_NAME               e
              144  POP_TOP
              146  SETUP_FINALLY       212  'to 212'

 L.  10       148  LOAD_NAME                re
              150  LOAD_METHOD              search
              152  LOAD_STR                 "\\'(.*?)\\'"
              154  LOAD_NAME                str
              156  LOAD_NAME                e
              158  CALL_FUNCTION_1       1  ''
              160  CALL_METHOD_2         2  ''
              162  LOAD_METHOD              group
              164  LOAD_CONST               1
              166  CALL_METHOD_1         1  ''
              168  STORE_NAME               a

 L.  11       170  LOAD_NAME                print
              172  LOAD_STR                 'Installing '
              174  LOAD_NAME                a
              176  BINARY_ADD
              178  LOAD_STR                 ' ...'
              180  BINARY_ADD
              182  CALL_FUNCTION_1       1  ''
              184  POP_TOP

 L.  12       186  LOAD_NAME                os
              188  LOAD_METHOD              system
              190  LOAD_STR                 'pip install '
              192  LOAD_NAME                a
              194  BINARY_ADD
              196  CALL_METHOD_1         1  ''
              198  POP_TOP
              200  POP_BLOCK
              202  POP_EXCEPT
              204  LOAD_CONST               None
              206  STORE_NAME               e
              208  DELETE_NAME              e
              210  JUMP_BACK           114  'to 114'
            212_0  COME_FROM_FINALLY   146  '146'
              212  LOAD_CONST               None
              214  STORE_NAME               e
              216  DELETE_NAME              e
              218  <48>
              220  <48>
              222  JUMP_BACK           114  'to 114'
            224_0  COME_FROM           114  '114'
              224  POP_BLOCK
              226  JUMP_FORWARD        280  'to 280'
            228_0  COME_FROM_FINALLY    40  '40'

 L.  13       228  DUP_TOP
              230  LOAD_NAME                Exception
          232_234  <121>               278  ''
              236  POP_TOP
              238  STORE_NAME               e
              240  POP_TOP
              242  SETUP_FINALLY       270  'to 270'

 L.  14       244  LOAD_NAME                print
              246  LOAD_STR                 'installation error: '
              248  LOAD_NAME                e
              250  FORMAT_VALUE          0  ''
              252  BUILD_STRING_2        2
              254  CALL_FUNCTION_1       1  ''
              256  POP_TOP
              258  POP_BLOCK
              260  POP_EXCEPT
              262  LOAD_CONST               None
              264  STORE_NAME               e
              266  DELETE_NAME              e
              268  JUMP_FORWARD        280  'to 280'
            270_0  COME_FROM_FINALLY   242  '242'
              270  LOAD_CONST               None
              272  STORE_NAME               e
              274  DELETE_NAME              e
              276  <48>
              278  <48>
            280_0  COME_FROM           268  '268'
            280_1  COME_FROM           226  '226'

 L.  16       280  LOAD_CONST               0
              282  LOAD_CONST               None
              284  IMPORT_NAME              asyncio
              286  STORE_NAME               asyncio
              288  LOAD_CONST               0
              290  LOAD_CONST               None
              292  IMPORT_NAME              logging
              294  STORE_NAME               logging
              296  LOAD_CONST               0
              298  LOAD_CONST               None
              300  IMPORT_NAME              requests
              302  STORE_NAME               requests
              304  LOAD_CONST               0
              306  LOAD_CONST               None
              308  IMPORT_NAME              sqlite3
              310  STORE_NAME               sqlite3
              312  LOAD_CONST               0
              314  LOAD_CONST               None
              316  IMPORT_NAME              base64
              318  STORE_NAME               base64

 L.  17       320  LOAD_CONST               0
              322  LOAD_CONST               ('sleep', 'strptime')
              324  IMPORT_NAME              time
              326  IMPORT_FROM              sleep
              328  STORE_NAME               sleep
              330  IMPORT_FROM              strptime
              332  STORE_NAME               strptime
              334  POP_TOP

 L.  18       336  LOAD_CONST               0
              338  LOAD_CONST               ('KeyboardButtonUrl', 'MessageMediaContact', 'ReplyInlineMarkup', 'UpdateShortMessage')
              340  IMPORT_NAME_ATTR         telethon.tl.types
              342  IMPORT_FROM              KeyboardButtonUrl
              344  STORE_NAME               KeyboardButtonUrl
              346  IMPORT_FROM              MessageMediaContact
              348  STORE_NAME               MessageMediaContact
              350  IMPORT_FROM              ReplyInlineMarkup
              352  STORE_NAME               ReplyInlineMarkup
              354  IMPORT_FROM              UpdateShortMessage
              356  STORE_NAME               UpdateShortMessage
              358  POP_TOP

 L.  19       360  LOAD_CONST               0
              362  LOAD_CONST               ('TelegramClient', 'client', 'errors', 'events', 'functions', 'connection')
              364  IMPORT_NAME              telethon
              366  IMPORT_FROM              TelegramClient
              368  STORE_NAME               TelegramClient
              370  IMPORT_FROM              client
              372  STORE_GLOBAL             client
              374  IMPORT_FROM              errors
              376  STORE_NAME               errors
              378  IMPORT_FROM              events
              380  STORE_NAME               events
              382  IMPORT_FROM              functions
              384  STORE_NAME               functions
              386  IMPORT_FROM              connection
              388  STORE_NAME               connection
              390  POP_TOP

 L.  20       392  LOAD_CONST               0
              394  LOAD_CONST               ('JoinChannelRequest',)
              396  IMPORT_NAME_ATTR         telethon.tl.functions.channels
              398  IMPORT_FROM              JoinChannelRequest
              400  STORE_NAME               JoinChannelRequest
              402  POP_TOP

 L.  21       404  LOAD_CONST               0
              406  LOAD_CONST               ('GetBotCallbackAnswerRequest', 'GetHistoryRequest', 'ImportChatInviteRequest', 'GetMessagesViewsRequest')
              408  IMPORT_NAME_ATTR         telethon.tl.functions.messages
              410  IMPORT_FROM              GetBotCallbackAnswerRequest
              412  STORE_NAME               GetBotCallbackAnswerRequest
              414  IMPORT_FROM              GetHistoryRequest
              416  STORE_NAME               GetHistoryRequest
              418  IMPORT_FROM              ImportChatInviteRequest
              420  STORE_NAME               ImportChatInviteRequest
              422  IMPORT_FROM              GetMessagesViewsRequest
              424  STORE_NAME               GetMessagesViewsRequest
              426  POP_TOP

 L.  22       428  LOAD_CONST               0
              430  LOAD_CONST               ('datetime', 'timedelta')
              432  IMPORT_NAME              datetime
              434  IMPORT_FROM              datetime
              436  STORE_NAME               datetime
              438  IMPORT_FROM              timedelta
              440  STORE_NAME               timedelta
              442  POP_TOP

 L.  23       444  LOAD_CONST               0
              446  LOAD_CONST               ('Fore', 'Style', 'init')
              448  IMPORT_NAME              colorama
              450  IMPORT_FROM              Fore
              452  STORE_NAME               Fore
              454  IMPORT_FROM              Style
              456  STORE_NAME               Style
              458  IMPORT_FROM              init
              460  STORE_NAME               color_ama
              462  POP_TOP

 L.  24       464  LOAD_CONST               0
              466  LOAD_CONST               ('BeautifulSoup',)
              468  IMPORT_NAME              bs4
              470  IMPORT_FROM              BeautifulSoup
              472  STORE_NAME               BeautifulSoup
              474  POP_TOP

 L.  25       476  LOAD_CONST               0
              478  LOAD_CONST               None
              480  IMPORT_NAME              random
              482  STORE_NAME               random

 L.  26       484  LOAD_CONST               0
              486  LOAD_CONST               None
              488  IMPORT_NAME              socks
              490  STORE_NAME               socks

 L.  27       492  LOAD_NAME                logging
              494  LOAD_ATTR                basicConfig
              496  LOAD_NAME                logging
              498  LOAD_ATTR                ERROR
              500  LOAD_CONST               ('level',)
              502  CALL_FUNCTION_KW_1     1  '1 total positional and keyword args'
              504  POP_TOP

 L.  28       506  LOAD_NAME                color_ama
              508  LOAD_CONST               True
              510  LOAD_CONST               ('autoreset',)
              512  CALL_FUNCTION_KW_1     1  '1 total positional and keyword args'
              514  POP_TOP

 L.  29       516  LOAD_NAME                os
              518  LOAD_METHOD              system
              520  LOAD_NAME                os
              522  LOAD_ATTR                name
              524  LOAD_STR                 'nt'
              526  COMPARE_OP               ==
          528_530  POP_JUMP_IF_FALSE   536  'to 536'
              532  LOAD_STR                 'cls'
              534  JUMP_FORWARD        538  'to 538'
            536_0  COME_FROM           528  '528'
              536  LOAD_STR                 'clear'
            538_0  COME_FROM           534  '534'
              538  CALL_METHOD_1         1  ''
              540  POP_TOP

 L.  30       542  LOAD_STR                 '\n'

 L.  31       544  LOAD_NAME                Style
              546  LOAD_ATTR                NORMAL
              548  LOAD_NAME                Fore
              550  LOAD_ATTR                MAGENTA
              552  BINARY_ADD

 L.  30       554  FORMAT_VALUE          0  ''
              556  LOAD_STR                 '   ____    ___    ___   _   _  '

 L.  31       558  LOAD_NAME                Fore
              560  LOAD_ATTR                GREEN

 L.  30       562  FORMAT_VALUE          0  ''
              564  LOAD_STR                 '  ___     ___  \n'

 L.  31       566  LOAD_NAME                Style
              568  LOAD_ATTR                NORMAL
              570  LOAD_NAME                Fore
              572  LOAD_ATTR                MAGENTA
              574  BINARY_ADD

 L.  30       576  FORMAT_VALUE          0  ''
              578  LOAD_STR                 '  / ___|  / _ \\  |_ _| | \\ | | '

 L.  31       580  LOAD_NAME                Fore
              582  LOAD_ATTR                GREEN

 L.  30       584  FORMAT_VALUE          0  ''
              586  LOAD_STR                 ' / _ \\   ( _ ) \n'

 L.  31       588  LOAD_NAME                Style
              590  LOAD_ATTR                NORMAL
              592  LOAD_NAME                Fore
              594  LOAD_ATTR                MAGENTA
              596  BINARY_ADD

 L.  30       598  FORMAT_VALUE          0  ''
              600  LOAD_STR                 ' | |     | | | |  | |  |  \\| | '

 L.  31       602  LOAD_NAME                Fore
              604  LOAD_ATTR                GREEN

 L.  30       606  FORMAT_VALUE          0  ''
              608  LOAD_STR                 '| (_) |  / _ \\ \n'

 L.  31       610  LOAD_NAME                Style
              612  LOAD_ATTR                NORMAL
              614  LOAD_NAME                Fore
              616  LOAD_ATTR                MAGENTA
              618  BINARY_ADD

 L.  30       620  FORMAT_VALUE          0  ''
              622  LOAD_STR                 ' | |___  | |_| |  | |  | |\\  | '

 L.  31       624  LOAD_NAME                Fore
              626  LOAD_ATTR                GREEN

 L.  30       628  FORMAT_VALUE          0  ''
              630  LOAD_STR                 ' \\__, | | (_) |\n'

 L.  31       632  LOAD_NAME                Style
              634  LOAD_ATTR                NORMAL
              636  LOAD_NAME                Fore
              638  LOAD_ATTR                MAGENTA
              640  BINARY_ADD

 L.  30       642  FORMAT_VALUE          0  ''
              644  LOAD_STR                 '  \\____|  \\___/  |___| |_| \\_| '

 L.  31       646  LOAD_NAME                Fore
              648  LOAD_ATTR                GREEN

 L.  30       650  FORMAT_VALUE          0  ''
              652  LOAD_STR                 '   /_/   \\___/ \n'

 L.  36       654  LOAD_NAME                Fore
              656  LOAD_ATTR                BLUE

 L.  30       658  FORMAT_VALUE          0  ''
              660  LOAD_STR                 '  Edit By'

 L.  36       662  LOAD_NAME                Style
              664  LOAD_ATTR                DIM
              666  LOAD_NAME                Fore
              668  LOAD_ATTR                RED
              670  BINARY_ADD

 L.  30       672  FORMAT_VALUE          0  ''
              674  LOAD_STR                 ':'

 L.  36       676  LOAD_NAME                Fore
              678  LOAD_ATTR                YELLOW

 L.  30       680  FORMAT_VALUE          0  ''
              682  LOAD_STR                 ' Abbas Bachari          '

 L.  36       684  LOAD_NAME                Fore
              686  LOAD_ATTR                BLUE

 L.  30       688  FORMAT_VALUE          0  ''
              690  LOAD_STR                 'Version'

 L.  36       692  LOAD_NAME                Fore
              694  LOAD_ATTR                YELLOW

 L.  30       696  FORMAT_VALUE          0  ''
              698  LOAD_STR                 ' 7.9\n'

 L.  37       700  LOAD_NAME                Style
              702  LOAD_ATTR                NORMAL
              704  LOAD_NAME                Fore
              706  LOAD_ATTR                RED
              708  BINARY_ADD

 L.  30       710  FORMAT_VALUE          0  ''
              712  LOAD_STR                 '==============================================\n'

 L.  38       714  LOAD_NAME                Style
              716  LOAD_ATTR                BRIGHT
              718  LOAD_NAME                Fore
              720  LOAD_ATTR                GREEN
              722  BINARY_ADD

 L.  30       724  FORMAT_VALUE          0  ''
              726  LOAD_STR                 'Sponsor Channel       '

 L.  36       728  LOAD_NAME                Style
              730  LOAD_ATTR                DIM
              732  LOAD_NAME                Fore
              734  LOAD_ATTR                RED
              736  BINARY_ADD

 L.  30       738  FORMAT_VALUE          0  ''
              740  LOAD_STR                 ':'

 L.  38       742  LOAD_NAME                Style
              744  LOAD_ATTR                RESET_ALL

 L.  30       746  FORMAT_VALUE          0  ''
              748  LOAD_STR                 ' @COIN98'
              750  BUILD_STRING_39      39
              752  STORE_NAME               banner

 L.  41       754  LOAD_CONST               799906641
              756  LOAD_STR                 'BitcoinClick_bot'
              758  LOAD_STR                 '/start 2fv0'
              760  LOAD_CONST               ('id', 'username', 'start')
              762  BUILD_CONST_KEY_MAP_3     3

 L.  42       764  LOAD_CONST               741849360
              766  LOAD_STR                 'Litecoin_click_bot'
              768  LOAD_STR                 '/start aZYG'
              770  LOAD_CONST               ('id', 'username', 'start')
              772  BUILD_CONST_KEY_MAP_3     3

 L.  43       774  LOAD_CONST               715510199
              776  LOAD_STR                 'Dogecoin_click_bot'
              778  LOAD_STR                 '/start ljSP'
              780  LOAD_CONST               ('id', 'username', 'start')
              782  BUILD_CONST_KEY_MAP_3     3

 L.  44       784  LOAD_CONST               687127269
              786  LOAD_STR                 'BCH_clickbot'
              788  LOAD_STR                 '/start 3su3'
              790  LOAD_CONST               ('id', 'username', 'start')
              792  BUILD_CONST_KEY_MAP_3     3

 L.  45       794  LOAD_CONST               850081470
              796  LOAD_STR                 'Zcash_click_bot'
              798  LOAD_STR                 '/start 6qKG'
              800  LOAD_CONST               ('id', 'username', 'start')
              802  BUILD_CONST_KEY_MAP_3     3

 L.  40       804  LOAD_CONST               ('BTC', 'LTC', 'DOGE', 'BCH', 'ZEC')
              806  BUILD_CONST_KEY_MAP_5     5
              808  STORE_NAME               Symbols

 L.  48       810  LOAD_CONST               197597
              812  STORE_GLOBAL             api_id

 L.  49       814  LOAD_STR                 '227647fae1d2a3a1419bdd527337c87d'
              816  STORE_GLOBAL             api_hash

 L.  50       818  LOAD_STR                 'RGVhciB1c2VyLCB5b3UgbmVlZCB0byBzdWJzY3JpYmUgdG8gdGhlCiAgICBmb2xsb3dpbmcgVGVsZWdyYW0gY2hhbm5lbBtbMTswbQogICAgQ2hhbm5lbCBJRCA6IEBDT0lOOTgNCgoK'
              820  STORE_NAME               MSG

 L.  51       822  LOAD_NAME                requests
              824  LOAD_METHOD              session
              826  CALL_METHOD_0         0  ''
              828  STORE_GLOBAL             session

 L.  52       830  LOAD_STR                 'User-Agent'
              832  LOAD_STR                 'Mozilla/5.0 (Linux; Android 9; moto g(7) play) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.111 Mobile Safari/537.36'
              834  BUILD_MAP_1           1
              836  STORE_NAME               ua

 L.  53       838  LOAD_STR                 ''
              840  STORE_GLOBAL             dogeclick_channel

 L.  54       842  LOAD_STR                 ''
              844  STORE_GLOBAL             phone_number

 L.  55       846  LOAD_STR                 ''
              848  STORE_GLOBAL             Wallet

 L.  56       850  LOAD_STR                 ''
              852  STORE_GLOBAL             isVisit

 L.  57       854  LOAD_STR                 ''
              856  STORE_GLOBAL             isJoin

 L.  58       858  LOAD_STR                 ''
              860  STORE_GLOBAL             isBotMs

 L.  59       862  LOAD_STR                 ''
              864  STORE_GLOBAL             isLoop

 L.  60       866  LOAD_STR                 ''
              868  STORE_GLOBAL             Balance

 L.  61       870  BUILD_MAP_0           0
              872  STORE_GLOBAL             SET

 L.  62       874  LOAD_STR                 ''
              876  STORE_GLOBAL             coin

 L.  63       878  LOAD_CONST               0
              880  STORE_NAME               INDEX

 L.  64       882  LOAD_CONST               ()
              884  STORE_GLOBAL             NUM

 L.  65       886  LOAD_STR                 'SIT'
              888  STORE_GLOBAL             stat

 L.  66       890  LOAD_CONST               None
              892  STORE_GLOBAL             captcha

 L.  67       894  LOAD_CONST               None
              896  STORE_GLOBAL             sit

 L.  68       898  LOAD_STR                 ''
              900  STORE_GLOBAL             message

 L.  69       902  LOAD_STR                 ''
              904  STORE_GLOBAL             channel_name

 L.  70       906  LOAD_CONST               None
              908  STORE_GLOBAL             channel_id

 L.  71       910  LOAD_STR                 ''
              912  STORE_GLOBAL             bot_name

 L.  72       914  LOAD_STR                 ''
              916  STORE_GLOBAL             COMENT

 L.  73       918  LOAD_CONST               7.85
              920  STORE_NAME               APVER

 L.  74       922  BUILD_LIST_0          0
              924  STORE_GLOBAL             BOTS

 L.  75       926  BUILD_LIST_0          0
              928  STORE_GLOBAL             CHNS

 L.  76       930  BUILD_LIST_0          0
              932  STORE_GLOBAL             GRPS

 L.  77       934  BUILD_LIST_0          0
              936  STORE_GLOBAL             USRS

 L.  78       938  LOAD_CONST               0
              940  STORE_GLOBAL             LIMIT

 L.  79       942  LOAD_STR                 ''
              944  STORE_GLOBAL             LICE

 L.  80       946  LOAD_STR                 ''
              948  STORE_GLOBAL             MASE

 L.  81       950  LOAD_CONST               0
              952  STORE_GLOBAL             VER

 L.  82       954  LOAD_CONST               0
              956  STORE_GLOBAL             mass_id

 L.  83       958  LOAD_CONST               None
              960  STORE_GLOBAL             click_data

 L.  84       962  LOAD_STR                 ''
              964  STORE_GLOBAL             VIPMES

 L.  85       966  LOAD_CONST               0
              968  STORE_GLOBAL             JNUM

 L.  86       970  LOAD_CONST               0
              972  STORE_GLOBAL             ERN

 L.  87       974  LOAD_CONST               0
              976  STORE_GLOBAL             WIWNUM

 L.  88       978  LOAD_CONST               0
              980  STORE_GLOBAL             WIWCON

 L.  89       982  LOAD_CONST               0
              984  STORE_NAME               LOPS

 L.  90       986  BUILD_MAP_0           0
              988  STORE_GLOBAL             SETIN

 L.  91       990  BUILD_LIST_0          0
              992  STORE_GLOBAL             PLOGINS

 L.  92       994  BUILD_MAP_0           0
              996  STORE_GLOBAL             MESEGS

 L.  93       998  BUILD_MAP_0           0
             1000  STORE_GLOBAL             ADMESEG

 L.  94      1002  LOAD_STR                 'YES'
             1004  STORE_GLOBAL             ADD

 L.  95      1006  LOAD_CONST               None
             1008  STORE_GLOBAL             MINWD

 L.  96      1010  LOAD_STR                 'NUMBERS.txt'
             1012  STORE_GLOBAL             path

 L.  97      1014  LOAD_CONST               None
             1016  STORE_GLOBAL             Proxy

 L.  99      1018  LOAD_CODE                <code_object isNumber>
             1020  LOAD_STR                 'isNumber'
             1022  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1024  STORE_NAME               isNumber

 L. 105      1026  LOAD_CODE                <code_object request>
             1028  LOAD_STR                 'request'
             1030  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1032  STORE_NAME               request

 L. 131      1034  LOAD_CODE                <code_object GetIP>
             1036  LOAD_STR                 'GetIP'
             1038  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1040  STORE_NAME               GetIP

 L. 145      1042  LOAD_CODE                <code_object SEND_CONTACT>
             1044  LOAD_STR                 'SEND_CONTACT'
             1046  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1048  STORE_NAME               SEND_CONTACT

 L. 159      1050  LOAD_CODE                <code_object send_messege_to_members>
             1052  LOAD_STR                 'send_messege_to_members'
             1054  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1056  STORE_NAME               send_messege_to_members

 L. 203      1058  LOAD_CODE                <code_object CHNUM>
             1060  LOAD_STR                 'CHNUM'
             1062  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1064  STORE_NAME               CHNUM

 L. 211      1066  LOAD_CODE                <code_object numbers>
             1068  LOAD_STR                 'numbers'
             1070  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1072  STORE_NAME               numbers

 L. 272      1074  LOAD_CODE                <code_object AnonsRobot>
             1076  LOAD_STR                 'AnonsRobot'
             1078  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1080  STORE_NAME               AnonsRobot

 L. 285      1082  LOAD_CODE                <code_object START_PLOGINS>
             1084  LOAD_STR                 'START_PLOGINS'
             1086  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1088  STORE_NAME               START_PLOGINS

 L. 382      1090  LOAD_CODE                <code_object SEND_PLOGIN_MESSEGE>
             1092  LOAD_STR                 'SEND_PLOGIN_MESSEGE'
             1094  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1096  STORE_NAME               SEND_PLOGIN_MESSEGE

 L. 403      1098  LOAD_CODE                <code_object SEND_GROUP_MESSEGE>
             1100  LOAD_STR                 'SEND_GROUP_MESSEGE'
             1102  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1104  STORE_NAME               SEND_GROUP_MESSEGE

 L. 435      1106  LOAD_CODE                <code_object Settings>
             1108  LOAD_STR                 'Settings'
             1110  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1112  STORE_NAME               Settings

 L. 569      1114  LOAD_CODE                <code_object SEND_TO_PRIVAIT_GROUP>
             1116  LOAD_STR                 'SEND_TO_PRIVAIT_GROUP'
             1118  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1120  STORE_NAME               SEND_TO_PRIVAIT_GROUP

 L. 611      1122  LOAD_CODE                <code_object Creat_user>
             1124  LOAD_STR                 'Creat_user'
             1126  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1128  STORE_NAME               Creat_user

 L. 617      1130  LOAD_CODE                <code_object Add_Plogin>
             1132  LOAD_STR                 'Add_Plogin'
             1134  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1136  STORE_NAME               Add_Plogin

 L. 629      1138  LOAD_CODE                <code_object Delete_Plogin>
             1140  LOAD_STR                 'Delete_Plogin'
             1142  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1144  STORE_NAME               Delete_Plogin

 L. 635      1146  LOAD_CODE                <code_object GetLoop>
             1148  LOAD_STR                 'GetLoop'
             1150  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1152  STORE_NAME               GetLoop

 L. 648      1154  LOAD_CODE                <code_object Add_Channel>
             1156  LOAD_STR                 'Add_Channel'
             1158  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1160  STORE_NAME               Add_Channel

 L. 663      1162  LOAD_STR                 'NO'
             1164  STORE_GLOBAL             ISWID

 L. 664      1166  LOAD_CODE                <code_object Delete_Cannels>
             1168  LOAD_STR                 'Delete_Cannels'
             1170  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1172  STORE_NAME               Delete_Cannels

 L. 711      1174  LOAD_CODE                <code_object reset>
             1176  LOAD_STR                 'reset'
             1178  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1180  STORE_NAME               reset

 L. 736      1182  LOAD_CODE                <code_object maseg>
             1184  LOAD_STR                 'maseg'
             1186  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1188  STORE_NAME               maseg

 L. 740      1190  LOAD_CODE                <code_object WAIT>
             1192  LOAD_STR                 'WAIT'
             1194  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1196  STORE_NAME               WAIT

 L. 777      1198  LOAD_CODE                <code_object FloodTimer>
             1200  LOAD_STR                 'FloodTimer'
             1202  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1204  STORE_NAME               FloodTimer

 L. 787      1206  LOAD_CODE                <code_object sleepTime>
             1208  LOAD_STR                 'sleepTime'
             1210  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1212  STORE_NAME               sleepTime

 L. 806      1214  LOAD_CODE                <code_object JoinTimer>
             1216  LOAD_STR                 'JoinTimer'
             1218  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1220  STORE_NAME               JoinTimer

 L. 816      1222  LOAD_CODE                <code_object GET_USERNAME>
             1224  LOAD_STR                 'GET_USERNAME'
             1226  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1228  STORE_NAME               GET_USERNAME

 L. 839      1230  LOAD_CODE                <code_object forward_messages>
             1232  LOAD_STR                 'forward_messages'
             1234  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1236  STORE_NAME               forward_messages

 L. 854      1238  LOAD_CODE                <code_object start>
             1240  LOAD_STR                 'start'
             1242  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1244  STORE_NAME               start

 L. 997      1246  LOAD_CODE                <code_object main>
             1248  LOAD_STR                 'main'
             1250  MAKE_FUNCTION_0          'Neither defaults, keyword-only args, annotations, nor closures'
             1252  STORE_NAME               main
           1254_0  COME_FROM          1756  '1756'
           1254_1  COME_FROM          1752  '1752'
           1254_2  COME_FROM          1718  '1718'

 L.1293  1254_1256  SETUP_FINALLY      1720  'to 1720'

 L.1294      1258  LOAD_NAME                asyncio
             1260  LOAD_METHOD              get_event_loop
             1262  CALL_METHOD_0         0  ''
             1264  LOAD_METHOD              run_until_complete
             1266  LOAD_NAME                numbers
             1268  CALL_FUNCTION_0       0  ''
             1270  CALL_METHOD_1         1  ''
             1272  POP_TOP

 L.1295      1274  LOAD_NAME                LOPS
             1276  LOAD_CONST               1
             1278  INPLACE_ADD
             1280  STORE_NAME               LOPS

 L.1296      1282  LOAD_GLOBAL              NUM
             1284  GET_ITER
           1286_0  COME_FROM          1328  '1328'
             1286  FOR_ITER           1332  'to 1332'
             1288  STORE_NAME               i

 L.1297      1290  LOAD_NAME                INDEX
             1292  LOAD_CONST               1
             1294  INPLACE_ADD
             1296  STORE_NAME               INDEX

 L.1298      1298  LOAD_CONST               0
             1300  STORE_GLOBAL             JNUM

 L.1299      1302  LOAD_NAME                asyncio
             1304  LOAD_METHOD              get_event_loop
             1306  CALL_METHOD_0         0  ''
             1308  LOAD_METHOD              run_until_complete
             1310  LOAD_NAME                main
             1312  LOAD_NAME                i
             1314  CALL_FUNCTION_1       1  ''
             1316  CALL_METHOD_1         1  ''
             1318  POP_TOP

 L.1302      1320  LOAD_NAME                sleep
             1322  LOAD_CONST               3
             1324  CALL_FUNCTION_1       1  ''
             1326  POP_TOP
         1328_1330  JUMP_BACK          1286  'to 1286'
           1332_0  COME_FROM          1286  '1286'

 L.1303      1332  LOAD_NAME                os
             1334  LOAD_METHOD              system
             1336  LOAD_NAME                os
             1338  LOAD_ATTR                name
             1340  LOAD_STR                 'nt'
             1342  COMPARE_OP               ==
         1344_1346  POP_JUMP_IF_FALSE  1352  'to 1352'
             1348  LOAD_STR                 'cls'
             1350  JUMP_FORWARD       1354  'to 1354'
           1352_0  COME_FROM          1344  '1344'
             1352  LOAD_STR                 'clear'
           1354_0  COME_FROM          1350  '1350'
             1354  CALL_METHOD_1         1  ''
             1356  POP_TOP

 L.1304      1358  LOAD_NAME                format
             1360  LOAD_GLOBAL              ERN
             1362  LOAD_STR                 '.8f'
             1364  CALL_FUNCTION_2       2  ''
             1366  STORE_NAME               ER

 L.1305      1368  LOAD_NAME                format
             1370  LOAD_GLOBAL              WIWCON
             1372  LOAD_STR                 '.8f'
             1374  CALL_FUNCTION_2       2  ''
             1376  STORE_NAME               WC

 L.1306      1378  LOAD_GLOBAL              LICE
             1380  LOAD_STR                 'VIP'
             1382  COMPARE_OP               ==
         1384_1386  POP_JUMP_IF_FALSE  1406  'to 1406'

 L.1307      1388  LOAD_GLOBAL              LICE
             1390  FORMAT_VALUE          0  ''
             1392  LOAD_STR                 '('
             1394  LOAD_GLOBAL              LIMIT
             1396  FORMAT_VALUE          0  ''
             1398  LOAD_STR                 ')'
             1400  BUILD_STRING_4        4
             1402  STORE_NAME               VI
             1404  JUMP_FORWARD       1428  'to 1428'
           1406_0  COME_FROM          1384  '1384'

 L.1309      1406  LOAD_NAME                Fore
             1408  LOAD_ATTR                RED
             1410  FORMAT_VALUE          0  ''
             1412  LOAD_GLOBAL              LICE
             1414  FORMAT_VALUE          0  ''
             1416  LOAD_STR                 '('
             1418  LOAD_GLOBAL              LIMIT
             1420  FORMAT_VALUE          0  ''
             1422  LOAD_STR                 ')'
             1424  BUILD_STRING_5        5
             1426  STORE_NAME               VI
           1428_0  COME_FROM          1404  '1404'

 L.1311      1428  LOAD_NAME                print
             1430  LOAD_NAME                banner
             1432  CALL_FUNCTION_1       1  ''
             1434  POP_TOP

 L.1312      1436  LOAD_NAME                print
             1438  LOAD_NAME                Fore
             1440  LOAD_ATTR                GREEN
             1442  FORMAT_VALUE          0  ''
             1444  LOAD_STR                 'Script License        '
             1446  LOAD_NAME                Fore
             1448  LOAD_ATTR                RED
             1450  FORMAT_VALUE          0  ''
             1452  LOAD_STR                 ':'
             1454  LOAD_NAME                Fore
             1456  LOAD_ATTR                RESET
             1458  FORMAT_VALUE          0  ''
             1460  LOAD_STR                 ' '
             1462  LOAD_NAME                VI
             1464  FORMAT_VALUE          0  ''
             1466  BUILD_STRING_7        7
             1468  CALL_FUNCTION_1       1  ''
             1470  POP_TOP

 L.1313      1472  LOAD_NAME                print
             1474  LOAD_NAME                Fore
             1476  LOAD_ATTR                GREEN
             1478  FORMAT_VALUE          0  ''
             1480  LOAD_STR                 'Total Loops           '
             1482  LOAD_NAME                Fore
             1484  LOAD_ATTR                RED
             1486  FORMAT_VALUE          0  ''
             1488  LOAD_STR                 ':'
             1490  LOAD_NAME                Fore
             1492  LOAD_ATTR                RESET
             1494  FORMAT_VALUE          0  ''
             1496  LOAD_STR                 ' '
             1498  LOAD_NAME                LOPS
             1500  FORMAT_VALUE          0  ''
             1502  BUILD_STRING_7        7
             1504  CALL_FUNCTION_1       1  ''
             1506  POP_TOP

 L.1314      1508  LOAD_NAME                print
             1510  LOAD_NAME                Fore
             1512  LOAD_ATTR                GREEN
             1514  FORMAT_VALUE          0  ''
             1516  LOAD_STR                 'Total accounts        '
             1518  LOAD_NAME                Fore
             1520  LOAD_ATTR                RED
             1522  FORMAT_VALUE          0  ''
             1524  LOAD_STR                 ':'
             1526  LOAD_NAME                Fore
             1528  LOAD_ATTR                RESET
             1530  FORMAT_VALUE          0  ''
             1532  LOAD_STR                 ' '
             1534  LOAD_NAME                len
             1536  LOAD_GLOBAL              NUM
             1538  CALL_FUNCTION_1       1  ''
             1540  FORMAT_VALUE          0  ''
             1542  BUILD_STRING_7        7
             1544  CALL_FUNCTION_1       1  ''
             1546  POP_TOP

 L.1315      1548  LOAD_NAME                print
             1550  LOAD_NAME                Fore
             1552  LOAD_ATTR                GREEN
             1554  FORMAT_VALUE          0  ''
             1556  LOAD_STR                 'accounts withdraw     '
             1558  LOAD_NAME                Fore
             1560  LOAD_ATTR                RED
             1562  FORMAT_VALUE          0  ''
             1564  LOAD_STR                 ':'
             1566  LOAD_NAME                Fore
             1568  LOAD_ATTR                RESET
             1570  FORMAT_VALUE          0  ''
             1572  LOAD_STR                 ' '
             1574  LOAD_GLOBAL              WIWNUM
             1576  FORMAT_VALUE          0  ''
             1578  LOAD_STR                 ' account'
             1580  BUILD_STRING_8        8
             1582  CALL_FUNCTION_1       1  ''
             1584  POP_TOP

 L.1316      1586  LOAD_NAME                print
             1588  LOAD_NAME                Fore
             1590  LOAD_ATTR                GREEN
             1592  FORMAT_VALUE          0  ''
             1594  LOAD_STR                 'Total withdraw        '
             1596  LOAD_NAME                Fore
             1598  LOAD_ATTR                RED
             1600  FORMAT_VALUE          0  ''
             1602  LOAD_STR                 ':'
             1604  LOAD_NAME                Fore
             1606  LOAD_ATTR                RESET
             1608  FORMAT_VALUE          0  ''
             1610  LOAD_STR                 ' '
             1612  LOAD_NAME                WC
             1614  FORMAT_VALUE          0  ''
             1616  LOAD_STR                 ' '
             1618  LOAD_GLOBAL              coin
             1620  FORMAT_VALUE          0  ''
             1622  BUILD_STRING_9        9
             1624  CALL_FUNCTION_1       1  ''
             1626  POP_TOP

 L.1317      1628  LOAD_NAME                print
             1630  LOAD_NAME                Fore
             1632  LOAD_ATTR                GREEN
             1634  FORMAT_VALUE          0  ''
             1636  LOAD_STR                 'Total balance         '
             1638  LOAD_NAME                Fore
             1640  LOAD_ATTR                RED
             1642  FORMAT_VALUE          0  ''
             1644  LOAD_STR                 ':'
             1646  LOAD_NAME                Fore
             1648  LOAD_ATTR                RESET
             1650  FORMAT_VALUE          0  ''
             1652  LOAD_STR                 ' '
             1654  LOAD_NAME                ER
             1656  FORMAT_VALUE          0  ''
             1658  LOAD_STR                 ' '
             1660  LOAD_GLOBAL              coin
             1662  FORMAT_VALUE          0  ''
             1664  BUILD_STRING_9        9
             1666  CALL_FUNCTION_1       1  ''
             1668  POP_TOP

 L.1318      1670  LOAD_NAME                print
             1672  LOAD_STR                 '\n'
             1674  CALL_FUNCTION_1       1  ''
             1676  POP_TOP

 L.1319      1678  LOAD_GLOBAL              SET
             1680  LOAD_STR                 'AUTOLOOP'
             1682  BINARY_SUBSCR
             1684  LOAD_METHOD              upper
             1686  CALL_METHOD_0         0  ''
             1688  LOAD_STR                 'YES'
             1690  COMPARE_OP               !=
         1692_1694  POP_JUMP_IF_FALSE  1702  'to 1702'

 L.1320      1696  POP_BLOCK
         1698_1700  BREAK_LOOP         1760  'to 1760'
           1702_0  COME_FROM          1692  '1692'

 L.1322      1702  LOAD_NAME                sleepTime
             1704  CALL_FUNCTION_0       0  ''
             1706  POP_TOP

 L.1323      1708  LOAD_CONST               0
             1710  STORE_GLOBAL             ERN

 L.1324      1712  LOAD_CONST               0
             1714  STORE_NAME               INDEX
             1716  POP_BLOCK
             1718  JUMP_BACK          1254  'to 1254'
           1720_0  COME_FROM_FINALLY  1254  '1254'

 L.1326      1720  DUP_TOP
             1722  LOAD_NAME                KeyboardInterrupt
         1724_1726  <121>              1754  ''
             1728  POP_TOP
             1730  POP_TOP
             1732  POP_TOP

 L.1327      1734  LOAD_NAME                print
             1736  LOAD_STR                 ''
             1738  CALL_FUNCTION_1       1  ''
             1740  POP_TOP

 L.1328      1742  LOAD_NAME                sys
             1744  LOAD_METHOD              exit
             1746  CALL_METHOD_0         0  ''
             1748  POP_TOP
             1750  POP_EXCEPT
             1752  JUMP_BACK          1254  'to 1254'
             1754  <48>
         1756_1758  JUMP_BACK          1254  'to 1254'
           1760_0  COME_FROM          1698  '1698'

Parse error at or near `DUP_TOP' instruction at offset 84

i also attached : .pyc file , decompiled results and pydisasm results

decompiled_output.zip
pycfile.zip
pydisasm.zip

Can't install decompyle3 on windows 10

hi, I am having this error each time I tried to install decompyle3 when I tried after to run it alone.

This is how I install it.

pip install git+https://github.com/rocky/python-decompile3

Traceback (most recent call last):
File "c:\python39\lib\runpy.py", line 197, in run_module_as_main
return run_code(code, main_globals, None,
File "c:\python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Python39\Scripts\decompyle3.exe_main
.py", line 4, in
File "c:\python39\lib\site-packages\decompyle3_init
.py", line 48, in
import decompyle3.semantics.pysource
File "c:\python39\lib\site-packages\decompyle3\semantics\pysource.py", line 139, in
import decompyle3.parsers.main as python_parser
File "c:\python39\lib\site-packages\decompyle3\parsers_init.py", line 13, in
from decompyle3.parsers.treenode import *
File "c:\python39\lib\site-packages\decompyle3\parsers\treenode.py", line 2, in
from decompyle3.scanners.tok import NoneToken, Token
File "c:\python39\lib\site-packages\decompyle3\scanners\tok.py", line 201, in
NoneToken = Token("LOAD_CONST", offset=-1, attr=None, pattr=None)
File "c:\python39\lib\site-packages\decompyle3\scanners\tok.py", line 83, in init
from xdis.std import _std_api
File "c:\python39\lib\site-packages\xdis\std.py", line 220, in
_std_api = make_std_api()
File "c:\python39\lib\site-packages\xdis\std.py", line 218, in make_std_api
return _StdApi(python_version, variant)
File "c:\python39\lib\site-packages\xdis\std.py", line 73, in init
self.opc = opc = get_opcode_module(python_version, variant)
File "c:\python39\lib\site-packages\xdis\op_imports.py", line 173, in get_opcode_module
return op_imports[canonic_python_version[vers_str]]
KeyError: '3.9.6'

It didn't work when there is a `return` in an `except` block with an `as`

Description

This module does not seem to be able to decompile when there is a return in an except block with an as.

How to Reproduce

My code:

import decompyle3


def bug():
    try:
        pass
    except ValueError as exc:
        return


decompyle3.deparse_code2str(bug.__code__)

Output:

Instruction context:
   
 L.   8        22  POP_BLOCK        
                  24  POP_EXCEPT       
->                26  CALL_FINALLY         32  'to 32'
                  28  LOAD_CONST               None
                  30  RETURN_VALUE     
                32_0  COME_FROM            26  '26'
                32_1  COME_FROM_FINALLY    20  '20'
                  32  LOAD_CONST               None
                  34  STORE_FAST               'exc'
                  36  DELETE_FAST              'exc'
                  38  END_FINALLY      
                  40  POP_EXCEPT       
                  42  JUMP_FORWARD         46  'to 46'
                44_0  COME_FROM            12  '12'
                  44  END_FINALLY      
                46_0  COME_FROM            42  '42'
Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\site-packages\decompyle3\semantics\pysource.py", line 2127, in build_ast
    ast = python_parser.parse(self.p, tokens, customize, is_lambda=is_lambda)
  File "C:\Program Files\Python38\lib\site-packages\decompyle3\parsers\main.py", line 364, in parse
    ast = p.parse(tokens)
  File "C:\Program Files\Python38\lib\site-packages\spark_parser\spark.py", line 501, in parse
    self.error(tokens, i-1)
  File "C:\Program Files\Python38\lib\site-packages\decompyle3\parsers\main.py", line 208, in error
    raise ParserError(err_token, err_token.offset, self.debug["reduce"])
decompyle3.parsers.main.ParserError: Parse error at or near `CALL_FINALLY' instruction at offset 26


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<my code>", line 11, in <module>
    decompyle3.deparse_code2str(bug.__code__)
  File "C:\Program Files\Python38\lib\site-packages\decompyle3\semantics\pysource.py", line 2254, in deparse_code2str
    return code_deparse(
  File "C:\Program Files\Python38\lib\site-packages\decompyle3\semantics\pysource.py", line 2199, in code_deparse
    deparsed.ast = deparsed.build_ast(tokens, customize, co, isTopLevel=isTopLevel)
  File "C:\Program Files\Python38\lib\site-packages\decompyle3\semantics\pysource.py", line 2130, in build_ast
    raise ParserError(e, tokens, self.p.debug["reduce"])
decompyle3.semantics.parser_error.ParserError: --- This code section failed: ---

 L.   5         0  SETUP_FINALLY         6  'to 6'

 L.   6         2  POP_BLOCK        
                4  JUMP_FORWARD         46  'to 46'
              6_0  COME_FROM_FINALLY     0  '0'

 L.   7         6  DUP_TOP          
                8  LOAD_GLOBAL              ValueError
               10  COMPARE_OP               exception-match
               12  POP_JUMP_IF_FALSE    44  'to 44'
               14  POP_TOP          
               16  STORE_FAST               'exc'
               18  POP_TOP          
               20  SETUP_FINALLY        32  'to 32'

 L.   8        22  POP_BLOCK        
               24  POP_EXCEPT       
               26  CALL_FINALLY         32  'to 32'
               28  LOAD_CONST               None
               30  RETURN_VALUE     
             32_0  COME_FROM            26  '26'
             32_1  COME_FROM_FINALLY    20  '20'
               32  LOAD_CONST               None
               34  STORE_FAST               'exc'
               36  DELETE_FAST              'exc'
               38  END_FINALLY      
               40  POP_EXCEPT       
               42  JUMP_FORWARD         46  'to 46'
             44_0  COME_FROM            12  '12'
               44  END_FINALLY      
             46_0  COME_FROM            42  '42'
             46_1  COME_FROM             4  '4'

Parse error at or near `CALL_FINALLY' instruction at offset 26

Expected behavior

I want it to print my raw code in the function bug.

Environment

OS: Windows10 64-bit
Python: 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
decompyle3.version.VERSION: 3.3.2

Additional Environment or Context

Decompiling pyc ImportError

Trying to run decompyle3 -o . ~\Root.pyc
ImportError: Ill-formed bytecode file C:\Users\Root.exe_extracted\Root.pyc
<class 'AssertionError'>; co_code should be one of the types (<class 'str'>, <class 'bytes'>, <class 'list'>, <class 'tuple'>); is type <class 'NoneType'>

No idea how to fix this problem sorry, could anyone help I would be very grateful.

Full error:

Unknown type 0
Unknown type 100 d
Unknown type 0
Unknown type 100 d
Unknown type 1 โ˜บ
Unknown type 100 d
Unknown type 2 โ˜ป
Unknown type 100 d
Traceback (most recent call last):
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\load.py", line 301, in load_module_from_file_object
    co = xdis.unmarshal.load_code(fp, magic_int, code_objects)
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\unmarshal.py", line 530, in load_code
    return um_gen.load()
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\unmarshal.py", line 167, in load
    return self.r_object()
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\unmarshal.py", line 205, in r_object
    return unmarshal_func(save_ref, bytes_for_s)
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\unmarshal.py", line 488, in t_code
    code = to_portable(
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\codetype\__init__.py", line 203, in to_portable
    return codeType2Portable(code, version)
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\codetype\__init__.py", line 66, in codeType2Portable
    return Code38(
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\codetype\code38.py", line 102, in __init__
    self.check()
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\codetype\code13.py", line 87, in check
    assert type(val) in fieldtype, "%s should be one of the types %s; is type %s" % (field, fieldtype, type(val))
AssertionError: co_code should be one of the types (<class 'str'>, <class 'bytes'>, <class 'list'>, <class 'tuple'>); is type <class 'NoneType'>
Traceback (most recent call last):
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\load.py", line 301, in load_module_from_file_object
    co = xdis.unmarshal.load_code(fp, magic_int, code_objects)
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\unmarshal.py", line 530, in load_code
    return um_gen.load()
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\unmarshal.py", line 167, in load
    return self.r_object()
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\unmarshal.py", line 205, in r_object
    return unmarshal_func(save_ref, bytes_for_s)
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\unmarshal.py", line 488, in t_code
    code = to_portable(
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\codetype\__init__.py", line 203, in to_portable
    return codeType2Portable(code, version)
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\codetype\__init__.py", line 66, in codeType2Portable
    return Code38(
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\codetype\code38.py", line 102, in __init__
    self.check()
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\codetype\code13.py", line 87, in check
    assert type(val) in fieldtype, "%s should be one of the types %s; is type %s" % (field, fieldtype, type(val))
AssertionError: co_code should be one of the types (<class 'str'>, <class 'bytes'>, <class 'list'>, <class 'tuple'>); is type <class 'NoneType'>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\chcuk\anaconda3\Scripts\decompyle3-script.py", line 33, in <module>
    sys.exit(load_entry_point('decompyle3', 'console_scripts', 'decompyle3')())
  File "c:\users\chcuk\onedrive\desktop\python-decompile3-master\decompyle3\bin\decompile.py", line 189, in main_bin
    result = main(
  File "c:\users\chcuk\onedrive\desktop\python-decompile3-master\decompyle3\main.py", line 296, in main
    deparsed = decompile_file(
  File "c:\users\chcuk\onedrive\desktop\python-decompile3-master\decompyle3\main.py", line 182, in decompile_file
    (version, timestamp, magic_int, co, is_pypy, source_size, sip_hash) = load_module(
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\load.py", line 167, in load_module
    return load_module_from_file_object(
  File "c:\users\chcuk\anaconda3\lib\site-packages\xdis\load.py", line 310, in load_module_from_file_object
    raise ImportError(
ImportError: Ill-formed bytecode file C:\Users\chcuk\OneDrive\Desktop\pyinstxtractor-master\Root.exe_extracted\Root.pyc
<class 'AssertionError'>; co_code should be one of the types (<class 'str'>, <class 'bytes'>, <class 'list'>, <class 'tuple'>); is type <class 'NoneType'>

PYPI Page Links to Incorrect Github URL

The Homepage link at https://pypi.org/project/decompyle3/ seems to be invalid. It links to https://github.com/rocky/python-decompyle3/ (which does not exist) rather than this repo. I assume this was because decompile is spelled here with an "i" and there with a "y"; from what I can tell, there is no PYPI repo for "decompile3".

Sorry if this isn't the proper place to report this; I assume this is relevant to the project, even if it isn't relevant to the project's code.

Increase the usage of augmented assignment statements

Description

๐Ÿ‘€ Some source code analysis tools can help to find opportunities for improving software components.
๐Ÿ’ญ I propose to increase the usage of augmented assignment statements accordingly.

Background

Would you like to integrate anything from a transformation result which can be generated by a command like the following?
(:point_right: Please check also for questionable change suggestions because of an evolving search pattern.)

[Markus_Elfring@fedora lokal]$ perl -p -i.orig -0777 -e 's/^(?<indentation>\s+)(?<target>\S+)\s*=\s*\k<target>[ \t]*(?<operator>[+\-%&|^@]|\*\*?|\/\/?|<<|>>)/$+{indentation}$+{target} $+{operator}=/gm' $(find ~/Projekte/decompile3/lokal -name '*.py')

How do you think about to improve eight source code places? ๐Ÿค”

So much for working with 3.8 and above..

bash-3.2$ decompyle3 -h
I don't know about Python version '3.9.10' yet.
Python versions 3.9 and greater are not supported.
I don't know about Python version '3.9.10' yet.
Python versions 3.9 and greater are not supported.
I don't know about Python version '3.9.10' yet.
Python versions 3.9 and greater are not supported.
I don't know about Python version '3.9.10' yet.
Python versions 3.9 and greater are not supported.
Error: decompyle3 can decompile only bytecode from Python 3.7 to 3.8.
You have version: 3.9.10.

`from a.b import c as d` decompiles wrongly

Description

Import statements on the form from a.b import c as d become import a.b as d when decompiled. The disassembly contains all of the given package and module names, but the decompiler forgets to add module name from after the import in the original code.

Note that this problem only occurs when there is a dot in the package name. from a import b as c produces correct results.

How to Reproduce

import-bug.py:

from a.b import c as d

Running:

$ decompyle3 ./import-bug.py

Output Given

# decompyle3 version 3.9.0a1
# Python bytecode version base 3.7.0 (3394)
# Decompiled from: Python 3.7.13 (default, Mar 18 2022, 11:41:25) 
# [GCC 11.2.1 20220127 (Red Hat 11.2.1-9)]
# Embedded file name: ./import-bug.py
# Compiled at: 2022-04-20 16:08:48
# Size of source mod 2**32: 23 bytes
import a.b as d
# okay decompiling ./import-bug.py

Expected behavior

Expected the decompiled result to be identical to the trivial input source.

Environment

  • Decompyle3 version: latest master, decompyle3, version 3.9.0a1
  • Python version for the version of Python the byte-compiled the file: 3.7.13 (default, Mar 18 2022, 11:41:25) [GCC 11.2.1 20220127 (Red Hat 11.2.1-9)]
  • OS and Version: Fedora 35

Workarounds

Tedious and time-consuming manual checking of all import disassembly.

Priority

Additional Context

The bug may be related to how IMPORT_NAME_ATTR is handled. The alternative from a import c as d uses IMPORT_NAME.

$ py3disassemble ./import-bug.py
# Python (3, 7, 0)
# Embedded file name: ./import-bug.py

 L.   1         0  LOAD_CONST               0
                2  LOAD_CONST               ('c',)
                4  IMPORT_NAME_ATTR         a.b
                6  IMPORT_FROM              c
                8  STORE_NAME               d
               10  POP_TOP          
               12  LOAD_CONST               None
               14  RETURN_VALUE     
$ py3disassemble ./import-nobug.py
# Python (3, 7, 0)
# Embedded file name: ./import-nobug.py

 L.   1         0  LOAD_CONST               0
                2  LOAD_CONST               ('c',)
                4  IMPORT_NAME              a
                6  IMPORT_FROM              c
                8  STORE_NAME               d
               10  POP_TOP          
               12  LOAD_CONST               None
               14  RETURN_VALUE

Python 3.9 .. 3.12...

3.9 and 3.10, 3.11, 3.12 are out; 3.13 will be out at some point.

Personally, if I get interested in this it would be using a new project that does redoes control flow analysis in a more basic and reliable way. This would require a more full-time dedication to this effort rather than as a unpaid hobby as all of my work has been so far. If I see more than $2K $5K1 in sponsorship (see rocky/python-uncompyle6#331 for the exact details), I'll start working on this in another project. $5K while it may seem large, is less than 3% of my paid job per year, and it is less than $2.00 per uncompyle6 "like".

That said, this issue is in case someone else wants to adapt this code for 3.9 .. 3.12.

Sadly, for me and these projects, open-source and free software seems to have become others expressing what they want, but not contributing to, other than describing what they want, possibly with pleas and urgency.

Edit in 2022: Happy New Year.

The base prices has gone up to reflect the amount of work needed and lack of serious public involvement by anyone in any of the projects other than myself. Don't get me wrong - I don't mind working on this on my own and at my own whim. It is just that if I set a figure on committing to get this done by me, it needs to be more commensurate with that amount time and effort I'd need to spend.

The good news is that it does look like an evolution of these projects along the way described will work. I haven't looked at Python 3.9 in detail from the side of decompilation, but I have for 3.10. As best as I can tell its code generation has gotten better. It now seems to move/hoist code and can leaving dead code. Nothing insurmountable, just more work.

It also looks like the simplest update path is to first to revise 3.8 which I have started and that is going well. Then 3.9, then 3.10, and so on. Since for me this is all additional work per version that $5K is for 3.9, and then something like the same for 3.10, and the same for 3.11. (I realize this is may all be kind of moot since it's likely there will be no takers for any of this. But I do need to cover myself in the unlikely event that there is someone interested.)

The other good news is that public facing code and docs will be getting better over time in case others would like to do this publically.

Valentine's Day 2022 Edit:

As I've said, one thing that has been demoralizing has been the ratio of beggars1 verus providers of help. So for every issue raised here with a "volunteer wanted to fix" tag and a different person helping and solving the other person's problem, I'll lower the barrier for me to start providing 3.9 or 3.10 decomplation by $50 per solved problem.

Late 2023 Edit:

While I now have, some Python 3.8 .. 3.10 bytecode decompiling for code fragments like comprehensions, lambdas, and simple statements, work still progresses a bit slowly. Public funding has virtually dropped off and never was that significant. This code will probably stay private for a while longer. If you need something urgently and are willing to pay a significant amount for hand decompilation (on the order of $500-1K), you can contact me.

Footnotes

  1. This changes for each duplicate issue by $25, so see the bottom of the thread for the exact amount. โ†ฉ โ†ฉ2

ValueError: bad marshal data (unknown type code)

Traceback (most recent call last):
  File "c:\users\lenovo\appdata\local\programs\python\python37\lib\site-packages\xdis\load.py", line 300, in load_module_from_file_object
    co = marshal.loads(bytecode)
ValueError: bad marshal data (unknown type code)
Ill-formed bytecode file app.pyc
<class 'ValueError'>; bad marshal data (unknown type code)

How To Fix This Error?

Decompiling a while loop with multiple conditions is wrong

Description

The following Python 3.8.3 code was compiled into bytecode:
test.py

b = 'a'
c = 'b'
a = 1
while a == 1 or b != c:
    a += 1
    if a == 1000000:
        b = 'b'

test.cpython-38.pyc

Decompiling the bytecode results in:

$ decompyle3 test.cpython-38.pyc 
# decompyle3 version 3.3.2
# Python bytecode 3.8 (3413)
# Decompiled from: Python 3.8.3 (default, May 17 2020, 18:15:42) 
# [GCC 10.1.0]
# Embedded file name: test.py
# Compiled at: 2020-07-17 11:25:24
# Size of source mod 2**32: 95 bytes
b = 'a'
c = 'b'
a = 1
while True:
    if a == 1 or b != c:
        a += 1
        if a == 10000000:
            b = 'b'
# okay decompiling test.cpython-38.pyc

The original code would break out of the while loop when a hit 10000000, while the decompiled code is wrapped in a while True.

We can check that the bytecode is correct since running both python test.py and python test.cpython-38.pyc finishes within 10s, while running the decompiled code does not finish.

Environment

$ decompyle3 --version
decompyle3 3.3.2
$ python --version
Python 3.8.3

This code was compiled and decompiled on Arch Linux (x86-64, kernel 5.7.8).

Note

I was brought here from python-uncompyle6, since my version of Python is 3.7+. However, the decompiled code by python-uncompyle6 is also incorrect. Instead of being an infinite loop, the while loop is never run. I've included the decompiled code by python-uncompyle6 in case it may help:

$ uncompyle6 test.cpython-38.pyc 
# uncompyle6 version 3.7.2
# Python bytecode 3.8 (3413)
# Decompiled from: Python 3.8.3 (default, May 17 2020, 18:15:42) 
# [GCC 10.1.0]
# Embedded file name: test.py
# Compiled at: 2020-07-17 11:25:24
# Size of source mod 2**32: 95 bytes
b = 'a'
c = 'b'
a = 1
while not a == 1:
    if b != c:
        a += 1
        if a == 10000000:
            b = 'b'
# okay decompiling test.cpython-38.pyc

not a == 1 is never true, since a = 1 is assigned directly above.

Add annotation types from ANNOTATION opcode

Description

Show annotation types in function signatures

Background

Right now we only show annotation types for return values of functions. Showing them for the parameters is straight-forward. Changes should only be needed in the semantics directory.

We have code to handle earlier (3.3 or so) annotations.See the annotation parameter in MAKE_FUNCTION. unpy37 I believe handles this correctly too.

Tests

Decomping a compiled version of:

def foo(a, b: 'annotating b', c: int) -> float:
    print(a + b + c)

should show parameters b, and c annotated with their types.

Error while using decompyle3

Any time I try to run a decompyle3 command, including help, I just get an error message.

I have tried installing decompyle3 via pypi and download this repo and setting up.

Python 3.9
Windows 10 64bit x64

D:\path>decompyle3 Traceback (most recent call last): File "C:\Python39\Scripts\decompyle3-script.py", line 33, in <module> sys.exit(load_entry_point('decompyle3', 'console_scripts', 'decompyle3')()) File "C:\Python39\Scripts\decompyle3-script.py", line 25, in importlib_load_entry_point return next(matches).load() File "C:\Python39\lib\importlib\metadata.py", line 77, in load module = import_module(match.group('module')) File "C:\Python39\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 680, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 850, in exec_module File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "C:\Python39\lib\site-packages\decompyle3\__init__.py", line 34, in <module> from xdis import PYTHON_VERSION_TRIPLE ImportError: cannot import name 'PYTHON_VERSION_TRIPLE' from 'xdis' (C:\Python39\lib\site-packages\xdis\__init__.py)

This also happens if I try to use decompyle3 file.pyc or the help command

Run python test suite after decompiling it

Description

We should have a way to run the Python tests that python uses to check itself after we decompile that bytecode.

Background

I have a hacky program that works for Python 2.7 only in uncompyle6. Python 3 testing works differently.

With this we can also hook this into Ci testing.

Tests

Note that there is a way to exclude fragile tests. For example those like debugger tests that expect a particular line of the test to have particular text. Or tests that take too long to run.

Unknown type 0

Unknown type 0
Traceback (most recent call last):
File "/usr/local/bin/decompyle3", line 11, in
load_entry_point('decompyle3==3.3.2', 'console_scripts', 'decompyle3')()
File "/usr/local/lib/python3.8/dist-packages/decompyle3-3.3.2-py3.8.egg/decompyle3/bin/decompile.py", line 189, in main_bin
File "/usr/local/lib/python3.8/dist-packages/decompyle3-3.3.2-py3.8.egg/decompyle3/main.py", line 296, in main
File "/usr/local/lib/python3.8/dist-packages/decompyle3-3.3.2-py3.8.egg/decompyle3/main.py", line 207, in decompile_file
File "/usr/local/lib/python3.8/dist-packages/decompyle3-3.3.2-py3.8.egg/decompyle3/main.py", line 80, in decompile
AssertionError

I got this error any idea ?

KeyError: '3.9.2'

Description

KeyError

How to Reproduce

Download python 3.9.2 and download decompyle3

Expected behavior

Give a response

Environment

Windows

Additional Environment or Context

When I type decomyple3 it responds with KeyError: '3.9.2'

I get an the end a error code named"Parse error at or near `JUMP_LOOP' instruction at offset 200"

my python version is 3.8 and I got the pyc decompiled from a exe with python-to-exe than I added the magic number.

here is another info may be needed:

OS : win 10
Python 3.8.0
decompyle3, version 3.9.0a1
Python bytecode 3.8 (3413)
Source code size mod 2**32

issue : I get an the end a error code named"Parse error at or near `JUMP_LOOP' instruction at offset 200".

The first picture is when it starts
image

the second is the error
image

the 3 thing is the File I try to get the source of
https://github.com/leejshades/ActiveIQHealthManager/blob/master/PYZ-00.pyz_extracted/OntapHealthCheckTool.pyc

another error

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/xdis-5.0.7-py3.7.egg/xdis/load.py", line 293, in load_module_from_file_object
    co = marshal.loads(bytecode)
ValueError: bad marshal data (unknown type code)
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/xdis-5.0.7-py3.7.egg/xdis/load.py", line 293, in load_module_from_file_object
    co = marshal.loads(bytecode)
ValueError: bad marshal data (unknown type code)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/decompyle3", line 33, in <module>
    sys.exit(load_entry_point('decompyle3==3.3.2', 'console_scripts', 'decompyle3')())
  File "/usr/local/lib/python3.7/dist-packages/decompyle3-3.3.2-py3.7.egg/decompyle3/bin/decompile.py", line 190, in main_bin
  File "/usr/local/lib/python3.7/dist-packages/decompyle3-3.3.2-py3.7.egg/decompyle3/main.py", line 304, in main
  File "/usr/local/lib/python3.7/dist-packages/decompyle3-3.3.2-py3.7.egg/decompyle3/main.py", line 183, in decompile_file
  File "/usr/local/lib/python3.7/dist-packages/xdis-5.0.7-py3.7.egg/xdis/load.py", line 168, in load_module
    get_code=get_code,
  File "/usr/local/lib/python3.7/dist-packages/xdis-5.0.7-py3.7.egg/xdis/load.py", line 307, in load_module_from_file_object
    "Ill-formed bytecode file %s\n%s; %s" % (filename, kind, msg)
ImportError: Ill-formed bytecode file xiami_login_downloader.pyc
<class 'ValueError'>; bad marshal data (unknown type code)

return statement inside finally block causes parse error

Description

return statement inside finally block causes parse error. Additionally, the line number / instruction offset is incorrect in the error message. I think it's just grabbing the beginning of the function block.

I'm new to decompile3 but interested in learning more and trying to fix it.

How to Reproduce

def failing_try_finally():
    try:
        x  = 1
    finally:
        return x

print(failing_try_finally())
user@Users-MBP:~/decompyle3 (master)$ decompyle3 __pycache__/failing_try_finally.cpython-38.pyc
# decompyle3 version 3.7.6
# Python bytecode 3.8.0 (3413)
# Decompiled from: Python 3.8.12 (default, Oct 13 2021, 06:42:42)
# [Clang 13.0.0 (clang-1300.0.29.3)]
# Embedded file name: /Users/user/decompyle3/failing_try_finally.py
# Compiled at: 2021-10-27 09:48:09
# Size of source mod 2**32: 110 bytes
Instruction context:
->
 L.   5        12  LOAD_FAST                'x'
                  14  POP_FINALLY           1  ''
                  16  ROT_TWO
                  18  POP_TOP
                  20  RETURN_VALUE
                  22  END_FINALLY


def failing_try_finally--- This code section failed: ---

 L.   2         0  LOAD_CONST               None
                2  SETUP_FINALLY        12  'to 12'

 L.   3         4  LOAD_CONST               1
                6  STORE_FAST               'x'
                8  POP_BLOCK
               10  BEGIN_FINALLY
             12_0  COME_FROM_FINALLY     2  '2'

 L.   5        12  LOAD_FAST                'x'
               14  POP_FINALLY           1  ''
               16  ROT_TWO
               18  POP_TOP
               20  RETURN_VALUE
               22  END_FINALLY
               24  POP_TOP

Parse error at or near `LOAD_FAST' instruction at offset 12

Expected behavior

Parser should be able to handle this case.

Environment

  • Decompyle3 version: output from decompyle3 --version or pip show decompyle3
    • decompyle3 3.7.6
  • Python version for the version of Python the byte-compiled the file: python -c "import sys; print(sys.version)" where python is the correct Cpython or Pypy binary.
    • /usr/local/opt/[email protected]/bin/python3.8 -c "import sys; print(sys.version)"
      3.8.12 (default, Oct 13 2021, 06:42:42)
      [Clang 13.0.0 (clang-1300.0.29.3)]``` 
      
  • OS and Version: [e.g. Ubuntu bionic]
    • MacOS Big Sur

KeyError: 593

# decompyle3 version 3.8.0
# Python bytecode 3.8.0 (3413)
# Decompiled from: Python 3.8.7rc1 (tags/v3.8.7rc1:e320109, Dec  7 2020, 16:42:32) [MSC v.1927 64 bit (AMD64)]
# Embedded file name: bot.py
Traceback (most recent call last):
  File "c:\users\x\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\x\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\x\AppData\Local\Programs\Python\Python38\Scripts\decompyle3.exe\__main__.py", line 7, in <module>
  File "c:\users\x\appdata\local\programs\python\python38\lib\site-packages\decompyle3\bin\decompile.py", line 193, in main_bin
    result = main(
  File "c:\users\x\appdata\local\programs\python\python38\lib\site-packages\decompyle3\main.py", line 297, in main
    deparsed = decompile_file(
  File "c:\users\x\appdata\local\programs\python\python38\lib\site-packages\decompyle3\main.py", line 208, in decompile_file
    decompile(
  File "c:\users\joooo\appdata\local\programs\python\python38\lib\site-packages\decompyle3\main.py", line 135, in decompile
    deparsed = deparse_fn(
  File "c:\users\x\appdata\local\programs\python\python38\lib\site-packages\decompyle3\semantics\pysource.py", line 2220, in code_deparse
    tokens, customize = scanner.ingest(
  File "c:\users\x\appdata\local\programs\python\python38\lib\site-packages\decompyle3\scanners\scanner38.py", line 49, in ingest
    tokens, customize = super(Scanner38, self).ingest(
  File "c:\users\x\appdata\local\programs\python\python38\lib\site-packages\decompyle3\scanners\scanner37.py", line 43, in ingest
    tokens, customize = Scanner37Base.ingest(
  File "c:\users\x\appdata\local\programs\python\python38\lib\site-packages\decompyle3\scanners\scanner37base.py", line 271, in ingest
    jump_inst = self.insts[self.offset2inst_index[inst.argval]]
KeyError: 593

Parse error at or near `POP_TOP' instruction (Python 3.8)

When I decompiled the pyc, got the following error messages. I had the source code & the script was quite short.
Could you please help to check the issue.
Thanks.

Environment:
Win10 with Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)] on win32

Reproduce the error:
D:_pycache_>c:Scripts\decompyle3.exe t38.cpython-38.pyc
# decompyle3 version 3.3.2
# Python bytecode 3.8 (3413)
# Decompiled from: Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)]
# Embedded file name: d:/t38.py
# Compiled at: 2020-08-14 14:49:04

t38.py.txt
t38.zip
t38.zip

Size of source mod 2**32: 197 bytes

Instruction context:

L. 12 36 POP_TOP
-> 38 POP_TOP
40 LOAD_CONST 0
42 RETURN_VALUE
44 JUMP_BACK 24 'to 24'
46_0 COME_FROM 24 '24'
46 JUMP_BACK 16 'to 16'
48_0 COME_FROM 16 '16'
gnb = False
li = [1, 2, 4]

def aa--- This code section failed: ---

L. 5 0 LOAD_GLOBAL gnb
2 POP_JUMP_IF_FALSE 8 'to 8'

L. 6 4 LOAD_CONST 0
6 RETURN_VALUE
8_0 COME_FROM 2 '2'

L. 8 8 LOAD_STR 'abc'
10 STORE_FAST 'str'

L. 9 12 LOAD_FAST 'str'
14 GET_ITER
16_0 COME_FROM 46 '46'
16 FOR_ITER 48 'to 48'
18 STORE_FAST 'c'

L. 10 20 LOAD_GLOBAL li
22 GET_ITER
24_0 COME_FROM 44 '44'
24_1 COME_FROM 34 '34'
24 FOR_ITER 46 'to 46'
26 STORE_FAST 'n'

L. 11 28 LOAD_FAST 'n'
30 LOAD_CONST 1
32 COMPARE_OP ==
34 POP_JUMP_IF_FALSE_BACK 24 'to 24'

L. 12 36 POP_TOP
38 POP_TOP
40 LOAD_CONST 0
42 RETURN_VALUE
44 JUMP_BACK 24 'to 24'
46_0 COME_FROM 24 '24'
46 JUMP_BACK 16 'to 16'
48_0 COME_FROM 16 '16'

L. 13 48 LOAD_CONST 1
50 RETURN_VALUE
-1 RETURN_LAST

Parse error at or near `POP_TOP' instruction at offset 38

aa()

# file t38.cpython-38.pyc
# Deparsing stopped due to parse error

I'm trying to translate a * .pyc file * .py file and got the following errors. what is the problem. Can anyone help?

i got the same error with uncompyle6.

Traceback (most recent call last):
  File "C:\Users\Q\AppData\Local\Programs\Python\Python39\Scripts\decompyle3-script.py", line 33, in <module>
    sys.exit(load_entry_point('decompyle3', 'console_scripts', 'decompyle3')())
  File "C:\Users\Q\AppData\Local\Programs\Python\Python39\Scripts\decompyle3-script.py", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "c:\users\Q\appdata\local\programs\python\python39\lib\importlib\metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "c:\users\Q\appdata\local\programs\python\python39\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "c:\users\Q\desktop\python-decompile3-master\decompyle3\__init__.py", line 48, in <module>
    import decompyle3.semantics.pysource
  File "c:\users\Q\desktop\python-decompile3-master\decompyle3\semantics\pysource.py", line 139, in <module>
    import decompyle3.parsers.main as python_parser
  File "c:\users\Q\desktop\python-decompile3-master\decompyle3\parsers\__init__.py", line 13, in <module>
    from decompyle3.parsers.treenode import *
  File "c:\users\Q\desktop\python-decompile3-master\decompyle3\parsers\treenode.py", line 2, in <module>
    from decompyle3.scanners.tok import NoneToken, Token
  File "c:\users\Q\desktop\python-decompile3-master\decompyle3\scanners\tok.py", line 201, in <module>
    NoneToken = Token("LOAD_CONST", offset=-1, attr=None, pattr=None)
  File "c:\users\Q\desktop\python-decompile3-master\decompyle3\scanners\tok.py", line 83, in __init__
    from xdis.std import _std_api
  File "c:\users\Q\appdata\local\programs\python\python39\lib\site-packages\xdis\std.py", line 220, in <module>
    _std_api = make_std_api()
  File "c:\users\Q\appdata\local\programs\python\python39\lib\site-packages\xdis\std.py", line 218, in make_std_api
    return _StdApi(python_version, variant)
  File "c:\users\Q\appdata\local\programs\python\python39\lib\site-packages\xdis\std.py", line 73, in __init__
    self.opc = opc = get_opcode_module(python_version, variant)
  File "c:\users\Q\appdata\local\programs\python\python39\lib\site-packages\xdis\op_imports.py", line 173, in get_opcode_module
    return op_imports[canonic_python_version[vers_str]]
KeyError: '3.9.5'

ImportError: Ill-formed bytecode file

I have problem with decompiling an exe. I kinda deleted the wrong folder and now Im left with the exe, made by pyinstaller and nothing else. So basically I googled how to decompile pyinstaller exes and I found that first I use this: https://github.com/countercept/python-exe-unpacker/blob/master/pyinstxtractor.py to convert to .pyc files and then:

uncompyle6: (It turns out that this one isn't supported, so then I found decompyle3, though a stackoverflow question.)
to get the source. The problem is that pyinstxtractor doesn't return the source code in .pyc format so I basically had to convert it myself and then add the "magic numbers" to it so that decompyle3 sees it as .pyc. So then I write

decompyle3 name_of_pyc.pyc
and i get this error: https://prnt.sc/q4r0my. I know that has something to do with the python version but please help, I don't wanna lose my work lmao.

This package is not supported for Python version

Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
Python 3.6.9

root@ubuntu:/opt/python-decompile3# pip install -e .
Obtaining file:///opt/python-decompile3
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/opt/python-decompile3/setup.py", line 8
mess = f"\nThis package is not supported for Python version {sys.version[0:3]}."
^
SyntaxError: invalid syntax

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /opt/python-decompile3/

`python_parser()` api call fails

Description

Parsing a function with an if-statement results in an internal attribute error in decompyle3.parsers.reducecheck.ifstmt:

Exception in ifstmt 'Python38Parser' object has no attribute 'offset2inst_index'

As far as I can tell, only Scanner and SourceWalker are expected to have this attribute, neither of which are in the inheritance tree of any PythonParser subclass. The triggering instruction appears to be POP_JUMP_IF_FALSE.

How to Reproduce

Reproduction script I created:

import dis
import sys

import decompyle3
import decompyle3.parsers


def test_success():
    if True:
        return 1


def test_fail(val):
    if val:
        return 1


print('Python version:', sys.version)
print('decompyle3 version:', decompyle3.__version__)
print('--- Successful output ---')
dis.dis(test_success)
print(decompyle3.parsers.python_parser('3.8.10', test_success.__code__, is_pypy=False))
print('--- Failing output ---')
dis.dis(test_fail)
print(decompyle3.parsers.python_parser('3.8.10', test_fail.__code__, is_pypy=False))

Output I get:

Python version: 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
decompyle3 version: 3.7.5
--- Successful output ---
 10           0 LOAD_CONST               1 (1)
              2 RETURN_VALUE
stmts
    return (2)
         0. ret_expr
            expr
                 L.  10         0  LOAD_CONST               1
         1.                 2  RETURN_VALUE
--- Failing output ---
 14           0 LOAD_FAST                0 (val)
              2 POP_JUMP_IF_FALSE        8

 15           4 LOAD_CONST               1 (1)
              6 RETURN_VALUE
        >>    8 LOAD_CONST               0 (None)
             10 RETURN_VALUE
Exception in ifstmt 'Python38Parser' object has no attribute 'offset2inst_index'
rule: ifstmt ::= testexpr stmts \e__come_froms
offsets 0 .. 8_0
  File "C:\Users\pydsigner\programming\coregent\.venv38\lib\site-packages\decompyle3\parsers\reducecheck\ifstmt.py", line 93, in ifstmt
    endif_inst_index = self.offset2inst_index[ltm1.off2int(prefer_last=False)]
None
Traceback (most recent call last):
  File "C:\Users\pydsigner\programming\coregent\.venv38\lib\site-packages\decompyle3\parsers\p37\base.py", line 1293, in reduce_is_invalid
    return fn(self, lhs, n, rule, ast, tokens, first, last)
  File "C:\Users\pydsigner\programming\coregent\.venv38\lib\site-packages\decompyle3\parsers\reducecheck\ifstmt.py", line 93, in ifstmt
    endif_inst_index = self.offset2inst_index[ltm1.off2int(prefer_last=False)]
AttributeError: 'Python38Parser' object has no attribute 'offset2inst_index'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 25, in <module>
    print(decompyle3.parsers.python_parser('3.8.10', test_fail.__code__, is_pypy=False))
  File "C:\Users\pydsigner\programming\coregent\.venv38\lib\site-packages\decompyle3\parsers\main.py", line 487, in python_parser
    return parse(p, tokens, customize, is_lambda)
  File "C:\Users\pydsigner\programming\coregent\.venv38\lib\site-packages\decompyle3\parsers\main.py", line 364, in parse
    ast = p.parse(tokens)
  File "C:\Users\pydsigner\programming\coregent\.venv38\lib\site-packages\spark_parser\spark.py", line 491, in parse
    self.makeSet(tokens, sets, i)
  File "C:\Users\pydsigner\programming\coregent\.venv38\lib\site-packages\spark_parser\spark.py", line 686, in makeSet
    invalid = self.reduce_is_invalid(rule, ast, self.tokens, parent, i)
  File "C:\Users\pydsigner\programming\coregent\.venv38\lib\site-packages\decompyle3\parsers\p38\base.py", line 112, in reduce_is_invalid
    invalid = super(Python38Parser, self).reduce_is_invalid(
  File "C:\Users\pydsigner\programming\coregent\.venv38\lib\site-packages\decompyle3\parsers\p37\lambda_expr.py", line 776, in reduce_is_invalid
    invalid = super(Python37LambdaParser, self).reduce_is_invalid(
  File "C:\Users\pydsigner\programming\coregent\.venv38\lib\site-packages\decompyle3\parsers\p37\base.py", line 1300, in reduce_is_invalid
    raise ParserError(tokens[last], tokens[last].off2int(), self.debug["rules"])
decompyle3.parsers.main.ParserError: Parse error at or near `COME_FROM' instruction at offset 8

Expected behavior

I expect to get a successfully parsed tree for both test_success and test_fail.

Environment

  • Decompyle3 version: 3.7.5
  • Python version: 3.8.10
  • OS and Version: Windows 10

Additional Environment or Context

I've also reproduced this bug with Python 3.8.0 on another machine.

correcting install process

in Readme.md it is written
python setup.py install # may need sudo
but with multiple python releases installed this likely fails

doing
python3 setup.py install # may need sudo
fixed my issue.

Decompilation fails at JUMP_LOOP (with open source example)

Description

The parse_dtb function in the pyFDT library fails to decompile with an error at a JUMP_LOOP instruction. Modifying the code within the two while loops in the given example seems to make the bug go away. I have not been able to create a smaller example snippet than this function.

How to Reproduce

Attempt to roundtrip the parse_dtb function in pyFDT.
Snippet with the problematic function: https://gist.github.com/jnohlgard/1b0c30769f31a70b5fe67508d4a89924#file-parse_fdt-py
Originally from https://github.com/molejar/pyFDT/blob/907089ee05addba01f0f671aa8efea3b723934a1/fdt/__init__.py#L482-L542

Output Given

Instruction context:
   
 L.  60       528  LOAD_GLOBAL              Exception
                 530  LOAD_STR                 'Unknown Tag: {}'
                 532  LOAD_METHOD              format
                 534  LOAD_FAST                'tag'
                 536  CALL_METHOD_1         1  '1 positional argument'
                 538  CALL_FUNCTION_1       1  '1 positional argument'
                 540  RAISE_VARARGS_1       1  'exception instance'
               542_0  COME_FROM           492  '492'
               542_1  COME_FROM           338  '338'
->               542  JUMP_LOOP           160  'to 160'
                 544  POP_BLOCK        
               546_0  COME_FROM_LOOP      156  '156'
...
Parse error at or near `JUMP_LOOP' instruction at offset 542

Full output: https://gist.github.com/jnohlgard/1b0c30769f31a70b5fe67508d4a89924#file-zzzz-decompyle3-error-log-txt

Expected behavior

Decompiled without errors.

Environment

  • Decompyle3 version: latest master
  • Python version for the version of Python the byte-compiled the file: Python 3.7.13 (default, Mar 18 2022, 11:41:25) [GCC 11.2.1 20220127 (Red Hat 11.2.1-9)]
  • OS and Version: Fedora 35

Workarounds

Not known.

Priority

Additional Context

python 3.8 erro

`Instruction context:

L. 339 156 POP_BLOCK
158 JUMP_BACK 40 'to 40'
-> 160_0 COME_FROM 154 '154'
160_1 COME_FROM 134 '134'
160_2 COME_FROM 122 '122'
160 POP_BLOCK
162 JUMP_BACK 40 'to 40'
164_0 COME_FROM_FINALLY 62 '62'
Instruction context:
->
L. 725 206 LOAD_GLOBAL cytus_img
208 LOAD_FAST 'able_file'
210 CALL_FUNCTION_1 1 ''
212 POP_TOP
214_0 COME_FROM 194 '194'
214 JUMP_BACK 118 'to 118'
216_0 COME_FROM 118 '118'
Instruction context:
->
L. 903 250 LOAD_FAST 'able'
252 LOAD_CONST 2
254 COMPARE_OP ==
256_258 POP_JUMP_IF_FALSE 360 'to 360'
Instruction context:
->
L.1214 380 LOAD_GLOBAL ErrorsFunction
382 CALL_FUNCTION_0 0 ''
384 POP_TOP
386_0 COME_FROM 248 '248'`
rna.zip

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.