| import glob | |
| import binascii | |
| filename = 'result.zip' | |
| with open(filename, 'rb') as f: | |
| content = f.read() | |
| hex = str(binascii.hexlify(content)) | |
| sz = len(hex) | |
| step = 10 | |
| for i in range(step): | |
| with open(f"out-{i}.txt", "w") as f: | |
| f.write(hex[sz//step * i: min(sz//step * (i + 1), sz)]) | |
| construct = "" | |
| for f in sorted(glob.glob("tmp/out*")): | |
| with open(f, 'r') as inf: | |
| construct += inf.read() | |
| bytes = binascii.unhexlify(construct[2:-1]) | |
| with open("constuction.zip", 'wb') as f: | |
| f.write(bytes) |