#!/usr/bin/env python3 # -*- coding: utf-8 -*- """READ-ONLY: enumerate every resident FIFA 17 DB table and dump its rows. See dbwalk.py header for the on-heap format. This version locates a table's layout block by its header signature (ncols<<16 | 0xffff) and matches on the column tag set. Opens /proc/PID/mem 'rb'; only seek()/read(). """ import glob, struct, sys, json CONST = 0x07C20760 def find_pid(): for d in glob.glob("/proc/[0-9]*"): try: if open(d + "/comm").read().strip() == "FIFA17.exe": return int(d.rsplit("/", 1)[-1]) except Exception: pass pid = find_pid() f = open("/proc/%d/mem" % pid, "rb") def rd(va, n): try: f.seek(va); b = f.read(n) return b if b and len(b) == n else None except Exception: return None def q(va): b = rd(va, 8) return struct.unpack(" 512 << 20 or hi < lo_lim or lo > hi_lim: continue out.append((max(lo, lo_lim), min(hi, hi_lim))) return out # ------- load the DB heap once ------- CHUNKS = [] for lo, hi in regions(0x06000000, 0x48000000): off = lo while off < hi: n = min(16 << 20, hi - off) d = rd(off, n) if d: CHUNKS.append((off, d)) off += n print("loaded %d chunks, %.0f MB" % (len(CHUNKS), sum(len(c[1]) for c in CHUNKS) / 1e6)) def scan(pat): out = [] for base, d in CHUNKS: i = d.find(pat) while i != -1: out.append(base + i) i = d.find(pat, i + 1) return out # ------- catalog ------- tables = {} for c in scan(struct.pack("