diff --git a/firmware/MeshOS-TDeck-1.1.8-merged.patched.bin b/firmware/MeshOS-TDeck-1.1.8-merged.patched.bin new file mode 100644 index 0000000..bb7cfee Binary files /dev/null and b/firmware/MeshOS-TDeck-1.1.8-merged.patched.bin differ diff --git a/firmware/Ultra-TDeck-v9.2-merged.patched.bin b/firmware/Ultra-TDeck-v9.2-merged.patched.bin new file mode 100644 index 0000000..1251a9b Binary files /dev/null and b/firmware/Ultra-TDeck-v9.2-merged.patched.bin differ diff --git a/patched_binaries/MeshOS-TDeck-1.1.8-merged.patched.bin b/patched_binaries/MeshOS-TDeck-1.1.8-merged.patched.bin index 51f4a31..bb7cfee 100644 Binary files a/patched_binaries/MeshOS-TDeck-1.1.8-merged.patched.bin and b/patched_binaries/MeshOS-TDeck-1.1.8-merged.patched.bin differ diff --git a/patched_binaries/MeshOS-TDeck-1.1.8.patched.bin b/patched_binaries/MeshOS-TDeck-1.1.8.patched.bin index 7bd197a..2b688f0 100644 Binary files a/patched_binaries/MeshOS-TDeck-1.1.8.patched.bin and b/patched_binaries/MeshOS-TDeck-1.1.8.patched.bin differ diff --git a/patched_binaries/Ultra-TDeck-v9.2.patched.bin b/patched_binaries/Ultra-TDeck-v9.2.patched.bin index cf11caa..7b8a0bd 100644 Binary files a/patched_binaries/Ultra-TDeck-v9.2.patched.bin and b/patched_binaries/Ultra-TDeck-v9.2.patched.bin differ diff --git a/verify_patches.py b/verify_patches.py index 5b20428..8f08251 100755 --- a/verify_patches.py +++ b/verify_patches.py @@ -2,56 +2,84 @@ import os import sys + def check_binary(file_path, patches): if not os.path.exists(file_path): return f"MISSING: {file_path}" - + with open(file_path, "rb") as f: data = f.read() - + results = [] 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()})") - elif data[offset:offset+len(patched)] == patched: + elif data[offset : offset + len(patched)] == patched: results.append(f" [PASS] {name}: PATCHED (found {patched.hex()})") else: - found = data[offset:offset+max(len(expected), len(patched))].hex() - results.append(f" [ERR] {name}: UNKNOWN (expected {patched.hex()}, found {found})") - + found = data[offset : offset + max(len(expected), len(patched))].hex() + results.append( + f" [ERR] {name}: UNKNOWN (expected {patched.hex()}, found {found})" + ) + return "\n".join(results) + if __name__ == "__main__": PATCHED_DIR = "/home/sapient/Public/esp32-analysis/patched_binaries" - + ultra_patches = [ ("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 = [ ("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 = [ - ("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"), - [(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]) + ( + "Ultra Standalone-MOD", + os.path.join(PATCHED_DIR, "Ultra-TDeck-v9.2.patched.bin"), + ultra_patches, + ), + ( + "Ultra Merged-MOD", + 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-MOD", + os.path.join(PATCHED_DIR, "MeshOS-TDeck-1.1.8.patched.bin"), + meshos_patches, + ), + ( + "MeshOS Merged-MOD", + 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 - print("=== Firmware Patch Verification Harness ===") + print("=== T-Deck-MOD Firmware Patch Verification Harness ===") for label, path, p in targets: print(f"\n{label}:") report = check_binary(path, p) print(report) if "[FAIL]" in report or "[ERR]" in report or "MISSING" in report: all_passed = False - + if all_passed: print("\n[COMPLETE] All binaries are fully patched.") sys.exit(0)