#!/usr/bin/env python3 """Guard the expanded original dispatcher probe callgraph; never execute originals.""" import argparse import hashlib import json from pathlib import Path import struct from collision_response import collect as kernel_collect, header, TARGETS from checkpoint_script_state import find_case, read_va from pe_inspect import PE EXTRA=( ('static_dispatch',0x47B4B0,0x47B889,'da4ca56149636d5fc5059403a0ef81a0007c96972e3c12f2a8dedfa7568dd160'), ('polygon_dispatch',0x47BBB0,0x47BD73,'b583bb88a97bef45961ad64a6b21533e9149d3dcb4a292d5dbe27db98d4dd325'), ('polygon_vertex',0x477F10,0x477F5F,'b5460f170b2315a462700d585b0626321186977a7bc192ede831a1e1ba60677c'), ('truncate',0x47F940,0x47F96A,'b1c1cecad44192fa8b32676658fcfea569fa1810741a5a5321c77f488c90b0b7')) POINTERS=(*TARGETS,0x509B24,0x49B1FC,0x4D6A04,0x4F69E5,0x695D46,0x695D4C,0x695D70,0x695D78) def collect(original): report=kernel_collect(original);pe=PE(find_case(Path(original),'Neutron.exe')) for name,start,end,digest in EXTRA: body=read_va(pe,start,end-start) if hashlib.sha256(body).hexdigest()!=digest:raise ValueError(f'Changed body {name}') report['bodies'].append(dict(name=name,va=hex(start),file_offset=hex(pe.offset(start-pe.base)),length=end-start,sha256=digest)) for target in POINTERS: value=struct.pack('