Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import lz4.block
- import struct
- INPUT_FILE_NAME = 'Hammer.lua'
- OUTPUT_FILE_NAME = 'Hammer.out.lua'
- with open(INPUT_FILE_NAME, 'rb') as f:
- data = f.read()
- header = data[:16]
- payload = data[16:]
- magic, outsize = struct.unpack('4sl8x', header)
- if (magic != 'LZ4 '):
- print "Invalid format"
- exit(1)
- if (outsize <= 0):
- print "Invalid ousize"
- exit(1)
- unpacked = lz4.block.decompress(payload, outsize)
- with open(OUTPUT_FILE_NAME, 'wb') as f:
- f.write(unpacked)
- print "Wrote %d bytes to file %s." % (outsize, OUTPUT_FILE_NAME)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement