"""Raw-image xref sweep (gotcha #21: the decomp export has gaps). Finds every CALL/JMP rel32 in .text whose target is one of the VAs given on the command line, plus any absolute immediate referencing them. python xref.py 0x4902b0 0x490308 """ import struct, sys PATH = r"C:\git\bt411\content\BTL4OPT.EXE" data = open(PATH, "rb").read() e_lfanew = struct.unpack_from(" %08x [%s]" % (addr, kind, tgt, sec)) print("\n%d xrefs" % len(hits))