367 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
66 lines
3.4 KiB
Python
66 lines
3.4 KiB
Python
"""Bounded public NetClient channel/queue metadata; no packet bodies or secrets.
|
|
|
|
Layouts follow captured NetClientSend and ResumeComms code for pinned70334.
|
|
Pointers are checked internally and exported only as ownership comparisons.
|
|
"""
|
|
import struct
|
|
|
|
NETCLIENT=0x145e7a098
|
|
TCP_VTABLE=0x1450396b0
|
|
|
|
def inspect(read, owner=None):
|
|
u64=lambda p:struct.unpack('<Q',read(p,8))[0]
|
|
u32=lambda p:struct.unpack('<I',read(p,4))[0]
|
|
original=read(NETCLIENT,8)
|
|
current=struct.unpack('<Q',original)[0]
|
|
if not current or (owner is not None and owner!=current):raise ValueError('Channel owner differs')
|
|
owner=current
|
|
state=u32(owner+0x98)
|
|
if state>32:raise ValueError('Channel state outside known range')
|
|
slots=read(owner+0x1a0,32);connections=struct.unpack('<4Q',slots)
|
|
flags=read(owner+0x218,2)
|
|
if any(v>1 for v in flags):raise ValueError('Channel suspension flag invalid')
|
|
listener=u64(owner+0x220)
|
|
rows=[]
|
|
for index,connection in enumerate(connections):
|
|
row=dict(slot=index,present=bool(connection))
|
|
if connection:
|
|
table=u64(connection)
|
|
row['tcp']=table==TCP_VTABLE
|
|
row['same_as_realm']=bool(index and connection==connections[0])
|
|
if table==TCP_VTABLE:row['listener_matches']=bool(listener and u64(connection+0x28)==listener)
|
|
holder=u64(owner+0x228+index*0x148)
|
|
row['pipe_holder_present']=bool(holder)
|
|
pipe=u64(holder) if holder else 0
|
|
row['pipe_present']=bool(pipe)
|
|
if pipe:
|
|
row['pipe_owner_matches']=u64(pipe+8)==owner
|
|
row['pipe_connection_matches']=bool(connection and u64(pipe+16)==connection)
|
|
if index<2:
|
|
head=owner+0x1e8+index*0x18
|
|
before=read(head,16);node=struct.unpack_from('<Q',before,8)[0]
|
|
seen=set();packets=[];truncated=False
|
|
while node and not node&1:
|
|
if node in seen:raise ValueError('Deferred queue cycle')
|
|
if len(seen)>=64:truncated=True;break
|
|
seen.add(node)
|
|
following=u64(node+8)
|
|
requested=read(node+0x10,1)[0]
|
|
length=u32(node+0x2c)
|
|
if requested>3 or not 4<=length<=1048576:raise ValueError('Deferred packet bounds differ')
|
|
# Do not follow the packet-storage field until its inline versus
|
|
# allocated representation is established. Queue length/route
|
|
# alone suffice for channel-lifecycle comparison.
|
|
if u64(node+8)!=following:raise ValueError('Deferred queue changed')
|
|
packets.append(dict(bytes=length,requested_route=requested))
|
|
node=following
|
|
if read(head,16)!=before:raise ValueError('Deferred queue changed')
|
|
first=struct.unpack_from('<Q',before,8)[0]
|
|
first_prev=bool(first and not first&1 and u64(first)==head)
|
|
row.update(suspended=bool(flags[index]),deferred_packets=packets,deferred_count=len(packets),deferred_truncated=truncated,
|
|
first_previous_is_head=first_prev if packets else None)
|
|
rows.append(row)
|
|
if read(owner+0x1a0,32)!=slots or read(owner+0x218,2)!=flags or read(NETCLIENT,8)!=original:raise ValueError('Channel ownership changed')
|
|
return dict(kind='public-engine-channel-lifecycle',state=state,channels=rows,
|
|
packet_bodies_read=False,authentication_buffers_read=False,engine_calls_made=False)
|