#!/usr/bin/env python3 # ELF32/64 program-header summary + extent + trailing-data check for QC images. import struct, sys, hashlib, re for fn in sys.argv[1:]: d = open(fn, "rb").read() if d[:4] != b"\x7fELF": print(f"{fn}: not ELF, head={d[:16].hex()} nonzero={sum(1 for b in d[:4096] if b)}"); continue c64 = d[4] == 2 if c64: e_entry, e_phoff = struct.unpack_from("