import struct, sys, io sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace') data = open('HAVOC_NOCD.EXE','rb').read() FO2VA = lambda fo: fo + 0x400C00 # Search for "corrupted" and "unavailable" strings for needle in [b'corrupt', b'unavail', b'CORRUPT', b'UNAVAIL', b'not found', b'NOT FOUND', b'cannot', b'CANNOT', b'missing', b'MISSING', b'invalid', b'INVALID']: idx = 0 while True: pos = data.find(needle, idx) if pos == -1: break # Print surrounding context start = max(0, pos - 4) end = min(len(data), pos + 60) snippet = data[start:end] printable = ''.join(chr(b) if 32 <= b < 127 else '.' for b in snippet) print("FO 0x%05x VA 0x%08x: %s" % (pos, FO2VA(pos), printable)) idx = pos + 1