Skip to content

Commit

Permalink
Fix #114
Browse files Browse the repository at this point in the history
  • Loading branch information
CensoredUsername committed Apr 4, 2021
1 parent 7d3e42a commit 8fbed82
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions deobfuscate.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,11 @@ def assert_is_normal_rpyc(f):
If succesful, returns the uncompressed contents of the first storage slot.
"""

diagnosis = []

f.seek(0)
header = f.read(1024)
f.seek(0)

if header_data[:10] != "RENPY RPC2":
if header[:10] != "RENPY RPC2":
# either legacy, or someone messed with the header

# assuming legacy, see if this thing is a valid zlib blob
Expand All @@ -256,7 +254,7 @@ def assert_is_normal_rpyc(f):
# 10 bytes header + 4 * 9 bytes content table
return ValueError("File too short")

a,b,c,d,e,f,g,h,i = struct.unpack("<IIIIIIIII", raw_contents[header + 10 : header + 46])
a,b,c,d,e,f,g,h,i = struct.unpack("<IIIIIIIII", header[10: 46])

# does the header format match default ren'py generated files?
if not (a == 1 and b == 46 and d == 2 and (g, h, i) == (0, 0, 0) and b + c == e):
Expand Down

0 comments on commit 8fbed82

Please sign in to comment.