CensoredUsername / unrpyc

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

Error while decompiling .rpyc #116

Closed bynejake closed 3 years ago

bynejake commented 3 years ago

error found while decompiling rpyc file error

after decompling the renpy file, found the script.py has been modified

def write_rpyc_data(self, f, slot, data): ...

f.seek(len(RPYC2_HEADER) + 12 * (slot - 1), 0)

   f.seek(len(RPYC2_HEADER) + 69 * (slot - 1), 0)
   f.write(struct.pack('III', slot, start, len(data)))

def read_rpyc_data(self, f, slot): .... if header_slot == 0: return None

pos += 12

        pos += 69

so how to fix this error? please help me.

madeddy commented 3 years ago

More infos about this problem would be helpful. A sample file or the name of the app where this happens could also help to collect more data...

For now you can try and change at the following position https://github.com/CensoredUsername/unrpyc/blob/3a49cfade57c67332702b65d51084435e1ce1e8b/unrpyc.py#L100 the + 12 to + 69 and also three lines later the same. https://github.com/CensoredUsername/unrpyc/blob/3f79b213994946ffc38af1168222789dfea0738b/unrpyc.py#L103

bynejake commented 3 years ago

only the xxgame/renpy/script.py changed. py

try unrpyc.py line 100 : slot, start, length = struct.unpack("III", raw_contents[position: position + 12]) 12 to 69, it will show the error error i think the method stuct.unpack("III", "sample") only accept the 12 length second arg.

try unrppyc.py line 103: position += 12 12 to 69, it will show the error error2 i think maybe read string out of range?

sample.zip

madeddy commented 3 years ago

Like expected. Wanted to see what happens. I believe(d) the changes in the script.py to be a trap to distract from the real change. Sry i could not be of any help.

Anyway, the problem should not unrpyc i'd say but some nonsense from the games developer. I dont know if the main dev here able is to help with this, but you can just wait if he has some free time too look some day in github. Greets

bynejake commented 3 years ago

found the solution, change unrpyc.py to : FIX

have no idea why this work, lol

CensoredUsername commented 3 years ago

Basically, they put the header in a different location in the file, and then didn't put a terminal header entry (0, 0, 0) in there. Have you tried the --try-harder flag? it'd've probably caught it anyway using zlibscan.