-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdump.py
More file actions
39 lines (31 loc) · 1.5 KB
/
Copy pathdump.py
File metadata and controls
39 lines (31 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# dump.py - Capture the final stable form of the unpacked modernmfw.img
# Thanks Gemini for the code. I dont have much time to write a new one, so I just copy and paste it here :v
import os
import shutil
import time
BASE_PATH = r"C:\Users\MeowIce\Downloads\HyperTN_V3.2_Zircon_China_OS3.0.5.0.WNOCNXM_A16_20260125"
SOURCE_FILE = os.path.join(BASE_PATH, "firmware-update", "modernmfw.img")
DUMP_DIR = os.path.join(BASE_PATH, "Dump")
def capture_final_form():
if not os.path.exists(DUMP_DIR): os.makedirs(DUMP_DIR)
print("[*] Waiting for file to appear...")
last_size = -1
while True:
if os.path.exists(SOURCE_FILE):
current_size = os.path.getsize(SOURCE_FILE)
if current_size > 0:
if current_size == last_size:
time.sleep(2)
if os.path.getsize(SOURCE_FILE) == current_size:
dest = os.path.join(DUMP_DIR, "modernmfw_FINAL.img")
try:
shutil.copy2(SOURCE_FILE, dest)
print(f"\n[OK] Captured the final form: {dest} ({current_size / 1024 / 1024:.2f} MB)")
break
except PermissionError:
pass
last_size = current_size
print(f"\r[*] Current size: {current_size / 1024 / 1024:.2f} MB...", end="")
time.sleep(0.2)
if __name__ == "__main__":
capture_final_form()