import sys, struct, hashlib TYPES = {0: "app", 1: "data"} APP = {0: "factory", 0x10: "ota_0", 0x11: "ota_1", 0x20: "test"} DATA = {0: "ota", 1: "phy", 2: "nvs", 3: "coredump", 4: "nvs_keys", 5: "efuse", 6: "undefined", 0x80: "esphttpd", 0x81: "fat", 0x82: "spiffs", 0x83: "littlefs"} data = open(sys.argv[1], "rb").read() if data[:2] != b"\xaa\x50": print("no partition table magic:", data[:16].hex()) sys.exit(1) rows = [] for i in range(0, len(data) - 32, 32): e = data[i:i + 32] if e[:2] != b"\xaa\x50": break magic, ptype, subtype, off, size = struct.unpack("8.0f} KB") print(f"\n{len(rows)} entries")