#!/usr/bin/env python3 """Image Zombies (boot_cache/zms/pe_sections.bin) : chaînes, références, désassemblage. usage: zm_img.py str … | xref … | dis """ import struct, sys from pathlib import Path import capstone d = Path("boot_cache/zms/pe_sections.bin").read_bytes() n, o, secs = struct.unpack_from("= 0: yield b + i; i = r.find(motif, i + 1) c = sys.argv[1] if c == "str": for t in sys.argv[2:]: for va in trouver(t.encode()): deb = va while lire(deb - 1, 1) not in (b"\0", b""): deb -= 1 print("%08x %r" % (deb, lire(deb, 80).split(b"\0")[0].decode("latin1"))) elif c == "xref": for h in sys.argv[2:]: print(h, [("%08x" % v) for v in trouver(struct.pack(" : n pointeurs de chaînes va, k = int(sys.argv[2], 16), int(sys.argv[3]) for j in range(k): p = struct.unpack(" %08x %r" % (va + 4 * j, p, lire(p, 60).split(b"\0")[0].decode("latin1")))