367 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
72 lines
3.2 KiB
Python
72 lines
3.2 KiB
Python
"""Observe the original corpse range predicate return; never invoke it.
|
|
|
|
Pinned original producer142155ec0 calls corpse-position142836a80 with
|
|
RSP+40, player-position1401f0060 with RSP+50, computes squared3D distance
|
|
into RBX's boolean, then calls eligibility142836020. At142156b1b AL is
|
|
the original predicate result. Only these typed results/positions are read.
|
|
"""
|
|
import math
|
|
import os
|
|
from pathlib import Path
|
|
import struct
|
|
|
|
ENTRY=0x142156b1b
|
|
PREFIX=bytes.fromhex('84c0750f410f28f1410f28f9450f28c1418bdf')
|
|
CALL=0x142156b16
|
|
CALL_PREFIX=bytes.fromhex('e805f56d00')
|
|
OWNER=0x14576e858
|
|
BASE=0x140000000
|
|
|
|
def inspect_context(read,executable,r):
|
|
if r.rip!=ENTRY or not executable(ENTRY,len(PREFIX)):
|
|
raise ValueError('Original corpse range boundary unavailable')
|
|
if read(ENTRY,len(PREFIX))!=PREFIX or read(CALL,5)!=CALL_PREFIX:
|
|
raise ValueError('Original corpse range code identity changed')
|
|
if not 0x10000<=r.rdi<0x0000800000000000 or not 0x10000<=r.rsp<0x0000800000000000:
|
|
raise ValueError('Original typed player/stack unavailable')
|
|
owner=read(OWNER,16)
|
|
low,high=struct.unpack('<QQ',owner)
|
|
if not low or high>>58!=2 or read(r.rdi+0x10,16)!=owner:
|
|
raise ValueError('Original player and corpse owner differ')
|
|
vtable=struct.unpack('<Q',read(r.rdi,8))[0]
|
|
if not BASE<=vtable<BASE+0x5000000:
|
|
raise ValueError('Original player type outside pinned image')
|
|
distance_result=r.rbx&0xffffffff
|
|
eligibility=r.rax&0xff
|
|
if distance_result not in(0,1) or eligibility not in(0,1):
|
|
raise ValueError('Original range result is not boolean')
|
|
corpse=struct.unpack('<3f',read(r.rsp+0x40,12))
|
|
player=struct.unpack('<3f',read(r.rsp+0x50,12))
|
|
if not all(math.isfinite(v) and abs(v)<100000 for v in(*corpse,*player)):
|
|
raise ValueError('Original range coordinates invalid')
|
|
squared=sum((a-b)**2 for a,b in zip(corpse,player))
|
|
return dict(kind='original-corpse-range-predicate-return-observed',
|
|
original_code_and_player_owner_verified=True,
|
|
original_distance_in_range=bool(distance_result),
|
|
original_eligibility_accepted=bool(eligibility),
|
|
actual_corpse_position=list(corpse),actual_player_position=list(player),
|
|
observed_squared_distance=squared,engine_calls_made=False,
|
|
authentication_buffers_read=False,code_modified=False,
|
|
protection_changes=False,raw_pointers_exported=False)
|
|
|
|
def capture_using(pid,registers,inspector):
|
|
intervals=[]
|
|
for line in Path(f'/proc/{pid}/maps').read_text().splitlines():
|
|
parts=line.split();lo,hi=(int(v,16)for v in parts[0].split('-'))
|
|
intervals.append((lo,hi,parts[1]))
|
|
def mapped(a,n,execute=False):
|
|
return any(lo<=a and a+n<=hi and 'r'in flags and(not execute or 'x'in flags)
|
|
for lo,hi,flags in intervals)
|
|
fd=os.open(f'/proc/{pid}/mem',os.O_RDONLY)
|
|
try:
|
|
def read(a,n):
|
|
if not 0<n<=32 or not mapped(a,n):raise ValueError('Fixed range read unavailable')
|
|
raw=os.pread(fd,n,a)
|
|
if len(raw)!=n:raise ValueError('Incomplete fixed range read')
|
|
return raw
|
|
return inspector(read,lambda a,n:mapped(a,n,True),registers)
|
|
finally:os.close(fd)
|
|
|
|
def capture(pid,registers):
|
|
return capture_using(pid,registers,inspect_context)
|