"""Bounded original PE setting3 data-flow leads; never invokes a client."""
from pathlib import Path
import importlib.util,json,struct
spec=importlib.util.spec_from_file_location('audit',Path(__file__).with_name('Audit-GalaxyClientCompatibility.py'))
m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m)
image=m.Image(Path('artifacts/ship-model-reference/client-copy/EliteDangerous64.exe'))
text=image.text_bytes;start=image.text.VirtualAddress;cursor=0;rows=[];total=0
while (cursor:=text.find(b'\xba\x03\x00\x00\x00',cursor))>=0:
rva=start+cursor;cursor+=5;total+=1
instructions=image.instructions(rva,128)
for index,op in enumerate(instructions[1:25],1):
# edx carries the second Win64 argument. Stop when this value is
# overwritten, or a preceding call may destroy volatile RDX.
if op.mnemonic in ('call','jmp'):
if '0x1f0]' in op.op_str:
span=image.function(rva)
rows.append(dict(rva=hex(rva),function=hex(span[0]) if span else None,
call=hex(op.address-image.base),instructions=[dict(rva=hex(x.address-image.base),instruction=x.mnemonic+' '+x.op_str) for x in instructions[:index+1]]))
break
if op.mnemonic not in ('cmp','test') and op.op_str.split(',')[0] in ('edx','rdx','dx','dl','dh'):break
result=dict(scope='Static bounded direct setting3 argument windows across entire .text. Not a proof that virtual/loop/block consumers are absent.',
imageSha256=__import__('hashlib').sha256(image.raw).hexdigest(),immediate3Windows=total,directCandidates=rows)
path=Path('artifacts/galaxy-query-research/constellations/whole-image-setting3-leads.json')
path.write_text(json.dumps(result,indent=2)+'\n')
print(json.dumps(dict(windows=total,functions=[r['function'] for r in rows]),indent=2))
"""Bounded original PE setting3 data-flow leads; never invokes a client."""
from pathlib import Path
import importlib.util,json,struct
spec=importlib.util.spec_from_file_location('audit',Path(__file__).with_name('Audit-GalaxyClientCompatibility.py'))
m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m)
image=m.Image(Path('artifacts/ship-model-reference/client-copy/EliteDangerous64.exe'))
text=image.text_bytes;start=image.text.VirtualAddress;cursor=0;rows=[];total=0
while (cursor:=text.find(b'\xba\x03\x00\x00\x00',cursor))>=0:
rva=start+cursor;cursor+=5;total+=1
instructions=image.instructions(rva,128)
for index,op in enumerate(instructions[1:25],1):
# edx carries the second Win64 argument. Stop when this value is
# overwritten, or a preceding call may destroy volatile RDX.
if op.mnemonic in ('call','jmp'):
if '0x1f0]' in op.op_str:
span=image.function(rva)
rows.append(dict(rva=hex(rva),function=hex(span[0]) if span else None,
call=hex(op.address-image.base),instructions=[dict(rva=hex(x.address-image.base),instruction=x.mnemonic+' '+x.op_str) for x in instructions[:index+1]]))
break
if op.mnemonic not in ('cmp','test') and op.op_str.split(',')[0] in ('edx','rdx','dx','dl','dh'):break
result=dict(scope='Static bounded direct setting3 argument windows across entire .text. Not a proof that virtual/loop/block consumers are absent.',
imageSha256=__import__('hashlib').sha256(image.raw).hexdigest(),immediate3Windows=total,directCandidates=rows)
path=Path('artifacts/galaxy-query-research/constellations/whole-image-setting3-leads.json')
path.write_text(json.dumps(result,indent=2)+'\n')
print(json.dumps(dict(windows=total,functions=[r['function'] for r in rows]),indent=2))