Advertisement
Guest User

Untitled

a guest
Sep 26th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import struct, sys, os
  2.  
  3. with open ("main.hal", 'rb') as hal:
  4. if not hal.read(4) == b'APUK':
  5. input("invalid file")
  6. sys.exit()
  7. os.makedirs("main")
  8. nument = struct.unpack('<L24x', hal.read(28))[0]
  9. entries = []
  10. for i in range(nument):
  11. entries.append(struct.unpack('<2L8x48s', hal.read(64)))
  12. for entry in entries:
  13. hal.seek(entry[1])
  14. content = hal.read(entry[0])
  15. name = entry[2].split(b'\00')[0].decode('ascii')
  16. with open ("main/"+name, 'wb') as output:
  17. output.write(content)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement