Last active
April 14, 2023 21:29
-
-
Save bigfarts/8d26766fbffe6b432dde181cd29d8d40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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