import struct, sys, os def needed(path): """Return DT_NEEDED names from a 32-bit little-endian ARM ELF.""" try: d = open(path, "rb").read() except Exception: return [] if d[:4] != b"\x7fELF" or d[4] != 1: # 32-bit only return [] e_phoff, = struct.unpack_from("offset via PT_LOAD def v2o(v): for i in range(e_phnum): o = e_phoff + i * e_phentsize p_type, p_offset, p_vaddr, _, p_filesz = struct.unpack_from("", ", ".join(needed(p)) or "(none)")