#!/usr/bin/env python3 """Read-only scan of the record pool embedded in the club-model owner object. The 18 resident player records sit at a fixed stride of 0x180 inside the owner object, below the embedded manager subobject at owner+0x1f9d8. This walks that pool to see whether storage for the five club items exists and what it holds. Read-only. Never writes. """ import re, struct, sys PID = int(sys.argv[1]) mem = open(f"/proc/{PID}/mem", "rb", buffering=0) def rd(a, n): mem.seek(a); return mem.read(n) def q(a): return struct.unpack("3} {'addr':>12} {'ctype':>6} {'subtyp':>6} {'state':>6} {'cat':>4} {'team':>5} {'kittyp':>6} set" print(hdr) n = (mgr - first) // 0x180 for k in range(min(n, 40)): a = first + k * 0x180 try: r = rd(a, 0xC0) except OSError: print(f" {k:>3} {a:#12x} unreadable"); break if len(r) < 0xC0: break ct, sub, st, cat, team = (struct.unpack_from("3} {a:#12x} {ct:>6} {sub:>6} {st:>6} {cat:>4} {team:>5} {kt:>6} {nz:>3}/192{flag}")