Compare commits
1 Commits
v1.0.0-MOD
...
v1.0.0-Glo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4a1021e14 |
BIN
firmware/MeshOS-TDeck-1.1.8-merged.patched.bin
Normal file
BIN
firmware/MeshOS-TDeck-1.1.8-merged.patched.bin
Normal file
Binary file not shown.
BIN
firmware/Ultra-TDeck-v9.2-merged.patched.bin
Normal file
BIN
firmware/Ultra-TDeck-v9.2-merged.patched.bin
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,47 +2,75 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def check_binary(file_path, patches):
|
def check_binary(file_path, patches):
|
||||||
if not os.path.exists(file_path):
|
if not os.path.exists(file_path):
|
||||||
return f"MISSING: {file_path}"
|
return f"MISSING: {file_path}"
|
||||||
|
|
||||||
with open(file_path, "rb") as f:
|
with open(file_path, "rb") as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
for name, offset, expected, patched in patches:
|
for name, offset, expected, patched in patches:
|
||||||
if data[offset:offset+len(expected)] == expected:
|
if data[offset : offset + len(expected)] == expected:
|
||||||
results.append(f" [FAIL] {name}: UNPATCHED (found {expected.hex()})")
|
results.append(f" [FAIL] {name}: UNPATCHED (found {expected.hex()})")
|
||||||
elif data[offset:offset+len(patched)] == patched:
|
elif data[offset : offset + len(patched)] == patched:
|
||||||
results.append(f" [PASS] {name}: PATCHED (found {patched.hex()})")
|
results.append(f" [PASS] {name}: PATCHED (found {patched.hex()})")
|
||||||
else:
|
else:
|
||||||
found = data[offset:offset+max(len(expected), len(patched))].hex()
|
found = data[offset : offset + max(len(expected), len(patched))].hex()
|
||||||
results.append(f" [ERR] {name}: UNKNOWN (expected {patched.hex()}, found {found})")
|
results.append(
|
||||||
|
f" [ERR] {name}: UNKNOWN (expected {patched.hex()}, found {found})"
|
||||||
|
)
|
||||||
|
|
||||||
return "\n".join(results)
|
return "\n".join(results)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
PATCHED_DIR = "/home/sapient/Public/esp32-analysis/patched_binaries"
|
PATCHED_DIR = "/home/sapient/Public/esp32-analysis/patched_binaries"
|
||||||
|
|
||||||
ultra_patches = [
|
ultra_patches = [
|
||||||
("UI Branch", 0xBA62D, bytes.fromhex("26153c"), bytes.fromhex("060f00")),
|
("UI Branch", 0xBA62D, bytes.fromhex("26153c"), bytes.fromhex("060f00")),
|
||||||
("Global Status (Round 2)", 0xBA6AD, bytes.fromhex("040242"), bytes.fromhex("221000ec"))
|
(
|
||||||
|
"Global Status (Round 2)",
|
||||||
|
0xBA6AD,
|
||||||
|
bytes.fromhex("040242"),
|
||||||
|
bytes.fromhex("221000"),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
meshos_patches = [
|
meshos_patches = [
|
||||||
("UI Branch", 0xB99ED, bytes.fromhex("26193c"), bytes.fromhex("060f00")),
|
("UI Branch", 0xB99ED, bytes.fromhex("26193c"), bytes.fromhex("060f00")),
|
||||||
("Global Status (Round 2)", 0xB9A54, bytes.fromhex("84210040"), bytes.fromhex("22100040"))
|
(
|
||||||
|
"Global Status (Round 2)",
|
||||||
|
0xB9A54,
|
||||||
|
bytes.fromhex("84210040"),
|
||||||
|
bytes.fromhex("22100040"),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
targets = [
|
targets = [
|
||||||
("Ultra Standalone", os.path.join(PATCHED_DIR, "Ultra-TDeck-v9.2.patched.bin"), ultra_patches),
|
(
|
||||||
("Ultra Merged", os.path.join(PATCHED_DIR, "Ultra-TDeck-v9.2-merged.patched.bin"),
|
"Ultra Standalone",
|
||||||
[(n, o+0x10000, e, p) for n, o, e, p in ultra_patches]),
|
os.path.join(PATCHED_DIR, "Ultra-TDeck-v9.2.patched.bin"),
|
||||||
("MeshOS Standalone", os.path.join(PATCHED_DIR, "MeshOS-TDeck-1.1.8.patched.bin"), meshos_patches),
|
ultra_patches,
|
||||||
("MeshOS Merged", os.path.join(PATCHED_DIR, "MeshOS-TDeck-1.1.8-merged.patched.bin"),
|
),
|
||||||
[(n, o+0x10000, e, p) for n, o, e, p in meshos_patches])
|
(
|
||||||
|
"Ultra Merged",
|
||||||
|
os.path.join(PATCHED_DIR, "Ultra-TDeck-v9.2-merged.patched.bin"),
|
||||||
|
[(n, o + 0x10000, e, p) for n, o, e, p in ultra_patches],
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"MeshOS Standalone",
|
||||||
|
os.path.join(PATCHED_DIR, "MeshOS-TDeck-1.1.8.patched.bin"),
|
||||||
|
meshos_patches,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"MeshOS Merged",
|
||||||
|
os.path.join(PATCHED_DIR, "MeshOS-TDeck-1.1.8-merged.patched.bin"),
|
||||||
|
[(n, o + 0x10000, e, p) for n, o, e, p in meshos_patches],
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
all_passed = True
|
all_passed = True
|
||||||
print("=== Firmware Patch Verification Harness ===")
|
print("=== Firmware Patch Verification Harness ===")
|
||||||
for label, path, p in targets:
|
for label, path, p in targets:
|
||||||
@@ -51,7 +79,7 @@ if __name__ == "__main__":
|
|||||||
print(report)
|
print(report)
|
||||||
if "[FAIL]" in report or "[ERR]" in report or "MISSING" in report:
|
if "[FAIL]" in report or "[ERR]" in report or "MISSING" in report:
|
||||||
all_passed = False
|
all_passed = False
|
||||||
|
|
||||||
if all_passed:
|
if all_passed:
|
||||||
print("\n[COMPLETE] All binaries are fully patched.")
|
print("\n[COMPLETE] All binaries are fully patched.")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user