1234567891011121314151617181920212223242526272829303132 |
- import sys
- def main():
- if len(sys.argv) < 3:
- print("Usage: python extract_compressed.py inputfile outputfile")
- return 1
- infile = sys.argv[1]
- outfile = sys.argv[2]
- f = open(infile, 'rb')
- try:
- contents = bytearray(f.read())
- finally:
- f.close()
- if (not ~contents.find(b'*FAB*', -100, -95) or contents[0] != ord('M')
- or contents[1] != ord('Z')
- or contents[8] != 2 or contents[9] != 0):
- print("Not an LZEXE executable, or not one that this program accepts")
- return 3
- f = open(outfile, 'wb')
- try:
- f.write(contents[32:-347])
- finally:
- f.close()
- if __name__ == "__main__":
- ret = main()
- if ret:
- sys.exit(ret)
|