XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEEDToolBox

【WinUI】XFE精英危险工具箱

公开
关注 0 Fork 0 Star 0
UTF-8
"""Close one external Native source RVA by reverse full-body matching.

This only inventories current DockingUpdate for the offline source audit. It
does not edit the flight hook, invoke game code, install a DLL or approve it.
"""
from pathlib import Path
import hashlib,importlib.util,json

spec=importlib.util.spec_from_file_location('audit','research/Audit-GalaxyClientCompatibility.py')
audit=importlib.util.module_from_spec(spec);spec.loader.exec_module(audit)
old=audit.Image(Path('artifacts/ship-model-reference/client-copy/EliteDangerous64.exe'))
new=audit.Image(Path('D:/SteamLibrary/steamapps/common/Elite Dangerous/Products/elite-dangerous-odyssey-64/EliteDangerous64.exe'))
current=0xE9A160;bounds=new.function(current)
if bounds is None or bounds[0]!=current:raise ValueError('Current DockingUpdate is not an exact function entry')
length=bounds[1]-current
reverse=audit.match(new,old,current,length)
if reverse['status']!='unique' or not reverse['newAtFunctionEntry']:raise ValueError('Current DockingUpdate does not identify a unique original source')
before=int(reverse['newRva'],16)
forward=audit.match(old,new,before,length)
if forward['status']!='unique' or int(forward['newRva'],16)!=current or not forward['newAtFunctionEntry']:raise ValueError('DockingUpdate full-body forward/reverse evidence disagrees')
source=Path('native/ManagedPlugin/Navigation.DockingZeroUpdate.cs');text=source.read_text()
if 'DockingUpdate=0xE9A160' not in text or 'DockingUpdateHook(nuint obj,float dt)' not in text:raise ValueError('External source contract changed')
prefix=bytes.fromhex('4055535657415441554156')
if old.data(before,len(prefix))!=prefix or new.data(current,len(prefix))!=prefix:raise ValueError('Actual DockingUpdate hook prefix differs')
forward['oldRva']=hex(before)
result=dict(runtimeNeutral=True,canInstallHooks=False,runtimeValidated=False,gameProcessAccess=False,gameCalls=0,
    oldImageSha256=hashlib.sha256(old.raw).hexdigest(),newImageSha256=hashlib.sha256(new.raw).hexdigest(),functions=[forward],slots=[],vtables={},globals={},
    references=[list(map(hex,row)) for row in audit.references(old,new,before,current,length)],
    reverseSearch=reverse,actualPrefix=prefix.hex(),source=dict(path=str(source),sha256=hashlib.sha256(source.read_bytes()).hexdigest()),
    scope='Actual current function entry and whole body / external source inventory only; no flight hook source modified or live invocation validated')
path=Path('artifacts/galaxy-client-compatibility/docking-zero-update-compatibility.json');path.write_text(json.dumps(result,indent=2)+'\n')
print(json.dumps(dict(path=str(path),oldRva=hex(before),newRva=hex(current),bytes=length,actualPrefix=prefix.hex(),bothDirectionsUnique=True)))