CensoredUsername / unrpyc

A ren'py script decompiler
Other
824 stars 149 forks source link

TypeError: __new__() takes exactly 4 arguments (5 given) #140

Closed renkerenke closed 2 years ago

renkerenke commented 2 years ago

Dark Magic 0.15.5 cannot be decompiled anymore, 0.15.0 worked.

I tried it with unrpyc 0.1.6 and 0.1.7, in the case of the latter additionally with --try-harder and un.rpyc deployed in the games/ folder.

Output of a normal run:

Decompiling options.rpyc to options.rpy...
Error while decompiling options.rpyc:
Traceback (most recent call last):
  File "/home/renke/Downloads/unrpa/unrpyc-1.1.7/unrpyc.py", line 190, in worker
    tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
  File "/home/renke/Downloads/unrpa/unrpyc-1.1.7/unrpyc.py", line 153, in decompile_rpyc
    ast = read_ast_from_file(in_file)
  File "/home/renke/Downloads/unrpa/unrpyc-1.1.7/unrpyc.py", line 126, in read_ast_from_file
    data, stmts = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"})
  File "/home/renke/Downloads/unrpa/unrpyc-1.1.7/decompiler/magic.py", line 599, in safe_loads
    encoding=encoding, errors=errors).load()
  File "/usr/lib64/python2.7/pickle.py", line 864, in load
    dispatch[key](self)
  File "/usr/lib64/python2.7/pickle.py", line 1089, in load_newobj
    obj = cls.__new__(cls, *args)
TypeError: __new__() takes exactly 4 arguments (5 given)

I don't know enough to decide if this is out-of-scope (some newish obfuscating technique) or a "real" unrpyc issue. options.rpyc.zip

CensoredUsername commented 2 years ago

I can confirm the bug report, that usually indicates some class definition made it into the rpyc file that unrpyc doesn't know about, often through the use of custom AST nodes. I'll investigate.

CensoredUsername commented 2 years ago

Looks like some very low-level ren'py AST nodes gained a py attribute that we didn't know about. It's fixed now.

llw12138 commented 1 year ago

Looks like some very low-level ren'py AST nodes gained a attribute that we did

看起来一些非常低级的 ren'py AST 节点获得了一个我们不知道的属性。现已修复。py

Error while decompiling C:\Users\25378\Desktop\D\unrpyc-master\work\screens.rpyc: Traceback (most recent call last): File "C:\Users\25378\Desktop\D\unrpyc-master\unrpyc.py", line 202, in worker tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder) File "C:\Users\25378\Desktop\D\unrpyc-master\unrpyc.py", line 165, in decompile_rpyc ast = read_ast_from_file(in_file) File "C:\Users\25378\Desktop\D\unrpyc-master\unrpyc.py", line 138, in read_ast_from_file data, stmts = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"}) File "C:\Users\25378\Desktop\D\unrpyc-master\decompiler\magic.py", line 599, in safe_loads encoding=encoding, errors=errors).load() File "C:\Python27\lib\pickle.py", line 864, in load dispatchkey File "C:\Python27\lib\pickle.py", line 1139, in load_reduce value = func(*args) File "C:\Users\25378\Desktop\D\unrpyc-master\decompiler\magic.py", line 113, in new raise FakeUnpicklingError("{0} was instantiated with unexpected arguments {1}, {2}".format(cls, args, kwargs)) FakeUnpicklingError: <class 'set'> was instantiated with unexpected arguments ([],), {}

Decompiling C:\Users\25378\Desktop\D\unrpyc-master\work\gui.rpyc to C:\Users\25378\Desktop\D\unrpyc-master\work\gui.rpy... Decompiling C:\Users\25378\Desktop\D\unrpyc-master\work\gallery.rpyc to C:\Users\25378\Desktop\D\unrpyc-master\work\gallery.rpy... Decompiling C:\Users\25378\Desktop\D\unrpyc-master\work\options.rpyc to C:\Users\25378\Desktop\D\unrpyc-master\work\options.rpy... Error while decompiling C:\Users\25378\Desktop\D\unrpyc-master\work\script.rpyc: Traceback (most recent call last): File "C:\Users\25378\Desktop\D\unrpyc-master\unrpyc.py", line 202, in worker tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder) File "C:\Users\25378\Desktop\D\unrpyc-master\unrpyc.py", line 165, in decompile_rpyc ast = read_ast_from_file(in_file) File "C:\Users\25378\Desktop\D\unrpyc-master\unrpyc.py", line 138, in read_ast_from_file data, stmts = magic.safe_loads(raw_contents, class_factory, {"_ast", "collections"}) File "C:\Users\25378\Desktop\D\unrpyc-master\decompiler\magic.py", line 599, in safe_loads encoding=encoding, errors=errors).load() File "C:\Python27\lib\pickle.py", line 864, in load dispatchkey File "C:\Python27\lib\pickle.py", line 1204, in load_setitem dict[key] = value TypeError: 'RevertableDict' object does not support item assignment

你好,我在反编译时出现了这两个问题,这两个问题有办法解决吗?

CensoredUsername commented 8 months ago

@llw12138 this issue is closed already, and this does not seem related directly. I also don't speak Chinese so I'm having a hard time figuring out what you want.