0

There is a huge problem with decompiling pyinstaller exe file,I tired uncompyle6, uncompyle3, decompyle++. Always main section is not decompiled. I wonder what's the problem. The program is working.

Exe file i'm trying to decompile:

https://cdn1.frocdn.ch/gm6YrcmZ15IKXin.exe

Kind regards,

Dan

1 Answer 1

1

'main' looks fine but the 'spammer' function is broken near the try-except block somehow. You can sort through the IL code to work it out, but it just looks like a Russian wrapper for this class:
https://docs.telethon.dev/en/stable/modules/client.html

Feeding script.pyc into https://www.toolnb.com/tools-lang-en/pyc.html:

# uncompyle6 version 3.5.0
# Python bytecode 3.8 (3413)
# Decompiled from: Python 2.7.5 (default, Jun 20 2023, 11:36:40) 
# [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
# Embedded file name: script.py
from telethon.sync import TelegramClient, errors
from time import sleep
from telethon.errors.rpcerrorlist import MessageTooLongError, PeerIdInvalidError
from os import system
import random
print(' \n             ___  ____   __    ___  ____    ___  _____  ____  ____   \n            / __)(  _ \\ /__\\  / __)( ___)  / __)(  _  )( ___)(_  _)\n            \\__ \\ )___//(__)\\( (__  )__)   \\__ \\ )(_)(  )__)   )(  \n            (___/(__) (__)(__)\\___)(____)  (___/(_____)(__)   (__)\n\n\n            Telegram: @Dspace_soft\n ')
sleep(2)
try:
    f = open('Api.txt', 'r')
    a = f.read().splitlines()
    api_id = a[0]
    api_hash = a[1]
    f.close()
except FileNotFoundError:
    system('cls')
    api_id = input('Enter id: ')
    api_hash = input('Enter hash: ')
    f = open('Api.txt', 'w')
    f.write(api_id + '\n' + api_hash)
    f.close()
else:
    client = TelegramClient('client', api_id, api_hash)

    def dialog_sort(dialog):
        return dialog.unread_count


    def spammer--- This code section failed: ---

  36       0  LOAD_GLOBAL              int
           2  LOAD_GLOBAL              input
           4  LOAD_CONST               u'\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443 \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438 (\u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445): '
           6  CALL_FUNCTION_1       1  ''
           8  CALL_FUNCTION_1       1  ''
          10  STORE_FAST               'delay'

  37      12  LOAD_CONST               0
          14  STORE_FAST               'k'

  38      16  LOAD_CONST               0
          18  STORE_FAST               'j'

  39      20  BUILD_LIST_0          0 
          22  BUILD_TUPLE_1         1 
          24  LOAD_CLOSURE             'client'
          26  BUILD_TUPLE_1         1 
          28  LOAD_CODE                <code_object create_groups_list>
          30  LOAD_STR                 'spammer.<locals>.create_groups_list'
          32  MAKE_FUNCTION_9          'default, closure'
          34  STORE_FAST               'create_groups_list'

  45      36  LOAD_DEREF               'client'
          38  SETUP_WITH          538  'to 538'
          42  POP_TOP          

  46      44  LOAD_DEREF               'client'
          46  LOAD_METHOD              iter_messages
          48  LOAD_STR                 'me'
          50  LOAD_CONST               1
          52  CALL_METHOD_2         2  ''
          54  GET_ITER         
          56  FOR_ITER             66  'to 66'
          58  STORE_FAST               'm'

  47      60  LOAD_FAST                'm'
          62  STORE_FAST               'msg'
          64  JUMP_BACK            56  'to 56'

  49      66  LOAD_FAST                'create_groups_list'
          68  CALL_FUNCTION_0       0  ''
          70  STORE_FAST               'groups'

  50      72  LOAD_FAST                'groups'
          74  LOAD_ATTR                sort
          76  LOAD_GLOBAL              dialog_sort
          78  LOAD_CONST               True
          80  LOAD_CONST               ('key', 'reverse')
          82  CALL_FUNCTION_KW_2     2  ''
          84  POP_TOP          

  51      86  LOAD_FAST                'groups'
          88  LOAD_CONST               None
          90  LOAD_CONST               10000
          92  BUILD_SLICE_2         2 
          94  BINARY_SUBSCR    
          96  GET_ITER         
          98  FOR_ITER            488  'to 488'
         102  STORE_FAST               'g'

  52     104  SETUP_FINALLY       134  'to 134'

  53     106  LOAD_DEREF               'client'
         108  LOAD_METHOD              forward_messages
         110  LOAD_FAST                'g'
         112  LOAD_FAST                'msg'
         114  LOAD_STR                 'me'
         116  CALL_METHOD_3         3  ''
         118  POP_TOP          

  54     120  LOAD_FAST                'k'
         122  LOAD_CONST               1
         124  BINARY_ADD       
         126  STORE_FAST               'k'
         128  POP_BLOCK        
         130  JUMP_FORWARD        474  'to 474'
       134_0  COME_FROM_FINALLY   104  '104'

  55     134  DUP_TOP          
         136  LOAD_GLOBAL              errors
         138  LOAD_ATTR                ForbiddenError
         140  COMPARE_OP               exception-match
         142  POP_JUMP_IF_FALSE   242  'to 242'
         144  POP_TOP          
         146  STORE_FAST               'o'
         148  POP_TOP          
         150  SETUP_FINALLY       230  'to 230'

  56     152  LOAD_DEREF               'client'
         154  LOAD_METHOD              delete_dialog
         156  LOAD_FAST                'g'
         158  CALL_METHOD_1         1  ''
         160  POP_TOP          

  57     162  LOAD_FAST                'g'
         164  LOAD_ATTR                entity
         166  LOAD_ATTR                username
         168  LOAD_CONST               None
         170  COMPARE_OP               !=
         172  POP_JUMP_IF_FALSE   202  'to 202'

  58     174  LOAD_GLOBAL              print
         176  LOAD_STR                 'Error: '
         178  LOAD_FAST                'o'
         180  LOAD_ATTR                message
         182  FORMAT_VALUE          0  ''
         184  LOAD_CONST               u' \u0410\u043a\u043a\u0430\u0443\u043d\u0442 \u043f\u043e\u043a\u0438\u043d\u0443\u043b @'
         186  LOAD_FAST                'g'
         188  LOAD_ATTR                entity
         190  LOAD_ATTR                username
         192  FORMAT_VALUE          0  ''
         194  BUILD_STRING_4        4  ''
         196  CALL_FUNCTION_1       1  ''
         198  POP_TOP          
         200  JUMP_FORWARD        226  'to 226'
         202  ELSE                     '226'

  60     202  LOAD_GLOBAL              print
         204  LOAD_STR                 'Error: '
         206  LOAD_FAST                'o'
         208  LOAD_ATTR                message
         210  FORMAT_VALUE          0  ''
         212  LOAD_CONST               u' \u0410\u043a\u043a\u0430\u0443\u043d\u0442 \u043f\u043e\u043a\u0438\u043d\u0443\u043b '
         214  LOAD_FAST                'g'
         216  LOAD_ATTR                name
         218  FORMAT_VALUE          0  ''
         220  BUILD_STRING_4        4  ''
         222  CALL_FUNCTION_1       1  ''
         224  POP_TOP          
       226_0  COME_FROM           200  '200'
         226  POP_BLOCK        
         228  BEGIN_FINALLY    
       230_0  COME_FROM_FINALLY   150  '150'
         230  LOAD_CONST               None
         232  STORE_FAST               'o'
         234  DELETE_FAST              'o'
         236  END_FINALLY      
         238  POP_EXCEPT       
         240  JUMP_FORWARD        474  'to 474'

  61     242  DUP_TOP          
         244  LOAD_GLOBAL              errors
         246  LOAD_ATTR                FloodError
         248  COMPARE_OP               exception-match
         250  POP_JUMP_IF_FALSE   302  'to 302'
         254  POP_TOP          
         256  STORE_FAST               'e'
         258  POP_TOP          
         260  SETUP_FINALLY       290  'to 290'

  62     262  LOAD_GLOBAL              print
         264  LOAD_STR                 'Error: '
         266  LOAD_FAST                'e'
         268  LOAD_ATTR                message
         270  FORMAT_VALUE          0  ''
         272  BUILD_STRING_2        2  ''
         274  CALL_FUNCTION_1       1  ''
         276  POP_TOP          

  63     278  POP_BLOCK        
         280  POP_EXCEPT       
         282  CALL_FINALLY        290  'to 290'
         284  JUMP_BACK            98  'to 98'
         286  POP_BLOCK        
         288  BEGIN_FINALLY    
       290_0  COME_FROM           282  '282'
       290_1  COME_FROM_FINALLY   260  '260'
         290  LOAD_CONST               None
         292  STORE_FAST               'e'
         294  DELETE_FAST              'e'
         296  END_FINALLY      
         298  POP_EXCEPT       
         300  JUMP_FORWARD        474  'to 474'

  64     302  DUP_TOP          
         304  LOAD_GLOBAL              PeerIdInvalidError
         306  COMPARE_OP               exception-match
         308  POP_JUMP_IF_FALSE   332  'to 332'
         312  POP_TOP          
         314  POP_TOP          
         316  POP_TOP          

  65     318  LOAD_DEREF               'client'
         320  LOAD_METHOD              delete_dialog
         322  LOAD_FAST                'g'
         324  CALL_METHOD_1         1  ''
         326  POP_TOP          
         328  POP_EXCEPT       
         330  JUMP_FORWARD        474  'to 474'

  66     332  DUP_TOP          
         334  LOAD_GLOBAL              MessageTooLongError
         336  COMPARE_OP               exception-match
         338  POP_JUMP_IF_FALSE   368  'to 368'
         342  POP_TOP          
         344  POP_TOP          
         346  POP_TOP          

  67     348  LOAD_GLOBAL              print
         350  LOAD_STR                 'Message was too long ==> '
         352  LOAD_FAST                'g'
         354  LOAD_ATTR                name
         356  FORMAT_VALUE          0  ''
         358  BUILD_STRING_2        2  ''
         360  CALL_FUNCTION_1       1  ''
         362  POP_TOP          
         364  POP_EXCEPT       
         366  JUMP_FORWARD        474  'to 474'

  68     368  DUP_TOP          
         370  LOAD_GLOBAL              errors
         372  LOAD_ATTR                BadRequestError
         374  COMPARE_OP               exception-match
         376  POP_JUMP_IF_FALSE   420  'to 420'
         380  POP_TOP          
         382  STORE_FAST               'i'
         384  POP_TOP          
         386  SETUP_FINALLY       408  'to 408'

  69     388  LOAD_GLOBAL              print
         390  LOAD_STR                 'Error: '
         392  LOAD_FAST                'i'
         394  LOAD_ATTR                message
         396  FORMAT_VALUE          0  ''
         398  BUILD_STRING_2        2  ''
         400  CALL_FUNCTION_1       1  ''
         402  POP_TOP          
         404  POP_BLOCK        
         406  BEGIN_FINALLY    
       408_0  COME_FROM_FINALLY   386  '386'
         408  LOAD_CONST               None
         410  STORE_FAST               'i'
         412  DELETE_FAST              'i'
         414  END_FINALLY      
         416  POP_EXCEPT       
         418  JUMP_FORWARD        474  'to 474'

  70     420  DUP_TOP          
         422  LOAD_GLOBAL              errors
         424  LOAD_ATTR                RPCError
         426  COMPARE_OP               exception-match
         428  POP_JUMP_IF_FALSE   472  'to 472'
         432  POP_TOP          
         434  STORE_FAST               'a'
         436  POP_TOP          
         438  SETUP_FINALLY       460  'to 460'

  71     440  LOAD_GLOBAL              print
         442  LOAD_STR                 'Error: '
         444  LOAD_FAST                'a'
         446  LOAD_ATTR                message
         448  FORMAT_VALUE          0  ''
         450  BUILD_STRING_2        2  ''
         452  CALL_FUNCTION_1       1  ''
         454  POP_TOP          
         456  POP_BLOCK        
         458  BEGIN_FINALLY    
       460_0  COME_FROM_FINALLY   438  '438'
         460  LOAD_CONST               None
         462  STORE_FAST               'a'
         464  DELETE_FAST              'a'
         466  END_FINALLY      
         468  POP_EXCEPT       
         470  JUMP_FORWARD        474  'to 474'
         472  END_FINALLY      
       474_0  COME_FROM           470  '470'
       474_1  COME_FROM           418  '418'
       474_2  COME_FROM           366  '366'
       474_3  COME_FROM           330  '330'
       474_4  COME_FROM           300  '300'
       474_5  COME_FROM           240  '240'
       474_6  COME_FROM           130  '130'

  72     474  LOAD_FAST                'j'
         476  LOAD_FAST                'k'
         478  BINARY_ADD       
         480  STORE_FAST               'j'

  73     482  LOAD_CONST               0
         484  STORE_FAST               'k'
         486  JUMP_BACK            98  'to 98'

  74     488  LOAD_GLOBAL              system
         490  LOAD_STR                 'cls'
         492  CALL_FUNCTION_1       1  ''
         494  POP_TOP          

  75     496  LOAD_GLOBAL              print
         498  LOAD_CONST               u'ID \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430:'
         500  LOAD_GLOBAL              api_id
         502  CALL_FUNCTION_2       2  ''
         504  POP_TOP          

  76     506  LOAD_GLOBAL              print
         508  LOAD_CONST               u'\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438\u0306: '
         510  LOAD_FAST                'j'
         512  CALL_FUNCTION_2       2  ''
         514  POP_TOP          

  77     516  LOAD_GLOBAL              sleep
         518  LOAD_FAST                'delay'
         520  CALL_FUNCTION_1       1  ''
         522  POP_TOP          

  78     524  LOAD_FAST                'groups'
         526  LOAD_METHOD              clear
         528  CALL_METHOD_0         0  ''
         530  POP_TOP          
         532  JUMP_BACK            66  'to 66'
         534  POP_BLOCK        
         536  BEGIN_FINALLY    
       538_0  COME_FROM_WITH       38  '38'
         538  WITH_CLEANUP_START
         540  WITH_CLEANUP_FINISH
         542  END_FINALLY      

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


    if __name__ == '__main__':
        spammer(client)

Looks like it's just a Telegram spammer.
The unicode strings are Russian prompts like:

Enter the delay between mailings (in seconds

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.