Skip to content

Instantly share code, notes, and snippets.

@bigfarts
Last active April 14, 2023 21:29
Show Gist options
  • Save bigfarts/8d26766fbffe6b432dde181cd29d8d40 to your computer and use it in GitHub Desktop.
Save bigfarts/8d26766fbffe6b432dde181cd29d8d40 to your computer and use it in GitHub Desktop.
import struct
FILENAME = "vol2.dat"
i = 0
max_offset = None
with open(FILENAME, "rb") as f:
f.seek(4 * 2)
while True:
z = f.read(4 * 3)
(offset, length, _) = struct.unpack("<III", z)
if max_offset is None:
max_offset = offset
pos = f.tell()
f.seek(offset)
with open(f"extracted/{i}.png", "wb") as f2:
f2.write(f.read(length))
f.seek(pos)
i += 1
if pos >= max_offset:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment