Create construction.py
Browse files- construction.py +25 -0
construction.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import glob
|
| 2 |
+
import binascii
|
| 3 |
+
|
| 4 |
+
filename = 'result.zip'
|
| 5 |
+
with open(filename, 'rb') as f:
|
| 6 |
+
content = f.read()
|
| 7 |
+
|
| 8 |
+
hex = str(binascii.hexlify(content))
|
| 9 |
+
|
| 10 |
+
sz = len(hex)
|
| 11 |
+
step = 10
|
| 12 |
+
for i in range(step):
|
| 13 |
+
with open(f"out-{i}.txt", "w") as f:
|
| 14 |
+
f.write(hex[sz//step * i: min(sz//step * (i + 1), sz)])
|
| 15 |
+
|
| 16 |
+
construct = ""
|
| 17 |
+
|
| 18 |
+
for f in sorted(glob.glob("tmp/out*")):
|
| 19 |
+
with open(f, 'r') as inf:
|
| 20 |
+
construct += inf.read()
|
| 21 |
+
|
| 22 |
+
bytes = binascii.unhexlify(construct[2:-1])
|
| 23 |
+
|
| 24 |
+
with open("constuction.zip", 'wb') as f:
|
| 25 |
+
f.write(bytes)
|