Files
WoW-Hybrid-gateway/ops/engine_world_enter_observation.py
praxisandClaude Fable 5.2 8a24c445b0 Content pipeline and operator tools
367 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

29 lines
1.6 KiB
Python

"""Observe the generated EnterWorld wrapper through its normal UI invocation.
Identified by installed registration lea at141346c6e. Never callable as a probe.
Only code bytes from its fixed naturally executable page are captured.
"""
import hashlib,os
from pathlib import Path
ENTRY=0x141343000
PREFIX=b''
OBSERVE_NATURAL_FIRST_USE=True
def capture(pid,registers):
if registers.rip!=ENTRY:return {'available':False,'reason':'different-entry'}
return capture_code(pid,ENTRY)
def capture_code(pid,entry):
if entry not in (ENTRY,0x1423fb340):raise ValueError('Fixed source-traced code entries only')
page=entry&~4095
maps=Path(f'/proc/{pid}/maps').read_text().splitlines()
matches=[r.split()[1] for r in maps if int(r.split()[0].split('-')[0],16)<=page and page+4096<=int(r.split()[0].split('-')[1],16)]
if len(matches)!=1:return {'available':False,'reason':'fixed-page-unmapped'}
fd=os.open(f'/proc/{pid}/mem',os.O_RDONLY)
try:code=os.pread(fd,4096,page)
finally:os.close(fd)
if len(code)!=4096:raise ValueError('Incomplete fixed code capture')
root=Path(__file__).resolve().parents[1];path=root/'runtime/native-handler-code'/f'{page:x}.bin'
if path.exists() and path.read_bytes()!=code:raise ValueError('Preserve prior code capture')
if not path.exists():path.write_bytes(code);path.chmod(0o600)
return dict(kind='natural-EnterWorld-code-only',available=True,page=hex(page),sha256=hashlib.sha256(code).hexdigest(),
permissions_at_entry=matches[0],code_plaintext_verified=False,
argument_or_authentication_buffers_read=False,engine_calls_made=False,memory_protection_changed=False)