Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import binascii, re
- start_hex = "89504E470D0A1A0A"
- end_hex = "49454E44AE426082"
- cursor = 0
- filecount = 1
- with open("res.bin", "rb") as file:
- resources = file.read()
- hexed = binascii.hexlify(resources).decode("ascii").upper()
- pngends = [a.start() for a in re.finditer(end_hex, hexed)]
- for end in pngends:
- filename = "img{0}.png".format(filecount)
- with open(filename, "wb") as img:
- img_data = start_hex + hexed[cursor:end+16]
- binary_string = binascii.unhexlify(img_data)
- img.write(binary_string)
- cursor = end + 16
- filecount += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement