#!/usr/bin/env python3 """Guarded Scooter drive/input source and copied-code probe preparation.""" import argparse,hashlib,json,re,struct,subprocess from pathlib import Path from scooter import collect as scooter_collect from checkpoint_script_state import find_case,read_va from pe_inspect import PE RANGES=((0x421910,0x421ba4),(0x467000,0x467045),(0x4669f0,0x466aea),(0x458890,0x458a00),(0x473320,0x47353a),(0x465220,0x46582d),(0x465830,0x465dfe),(0x421c10,0x421cf7), (0x476ff0,0x477490),(0x4723f0,0x472420),(0x472480,0x472570),(0x472b10,0x472c10)) EVIDENCE_RANGES=RANGES+((0x467080,0x4679c0),(0x468020,0x468300), (0x412f90,0x413030),(0x466af0,0x466b30),(0x425120,0x425170), (0x41e0f9,0x41e1f8),(0x41e2f0,0x41e3a0),(0x408e40,0x409010)) def collect(original): report=scooter_collect(original);pe=PE(find_case(Path(original),'Neutron.exe')) # Only absolute data/IAT references found in decoded disassembly are eligible. targets=set() for start,end in RANGES: result=subprocess.run(['objdump','-d','-Mintel',f'--start-address={start}',f'--stop-address={end}',str(pe.path)],capture_output=True,text=True,check=True) targets.update(int(v,16) for v in re.findall(r'ds:0x([0-9a-f]+)',result.stdout)) targets.update((0x48d104,0x48d10c)) report['motion_ranges']=[dict(va=hex(start),file_offset=hex(pe.offset(start-pe.base)),length=end-start, sha256=hashlib.sha256(read_va(pe,start,end-start)).hexdigest()) for start,end in EVIDENCE_RANGES] report['motion_relocations']=[] for start,end in RANGES: data=read_va(pe,start,end-start) for target in sorted(targets): for match in re.finditer(re.escape(struct.pack('