Repository navigation
Tooling
Python 3.9 or newer, standard library only, run from the repository root. The tests drive the mock; none
starts the game. The index below covers the parts used by the investigation; the public toolset also
includes tools/patch_client.py (byte-verified profiles), tools/registry_server.py (server list,
heartbeats, liveness probes) and tools/overlay/ (out-of-process UI for unpatched clients).
The public tree ships these under tools/. Each entry says what it is for; the sections below cover the ones
the investigation leans on most.
| tool | what it is |
|---|---|
mock_appserver.py |
the reference server: haxe.remoting plus the plain-JSON PGS legs |
tools/haxe_ser.py |
serializer/deserializer for the game's wire format |
tools/hxinflate.py |
parser for the entity type-info stream |
tools/pakdump.py |
UE4 v3 pak reader: info, list, extract
|
tools/pak_patch_url.py |
same-length URL patch with the three hash refreshes; reversible |
tools/build_host.py |
the original ni13 recipe: byte patches only, no cave support, so started directly it stops at the launcher check. Kept for reproducing that build; use patch_client.py --profile host-play for a host that logs in |
tools/patch_client.py |
profile-driven patcher (client, cosmetics, host) with byte verification |
tools/fix_pe_checksum.py |
recompute the PE optional-header checksum; --check reports stored vs computed |
tools/registry_server.py |
community-server registry: heartbeats, TTL, liveness probes |
tools/verify_server.py |
conformance check for any server implementation |
tools/stream_engine.py |
the stream layer's selection engine: polls, simulated audience, weighted rotation |
tools/mdread.py |
minidump reader: exception record, threads, modules, raw stack scan |
tools/memdump.py |
hexdump arbitrary addresses out of a minidump |
tools/unwind.py, tools/stackscan.py, tools/throwscan.py, tools/u16scan.py
|
analysis helpers for a dump or an image |
tools/frida_mod_banner_watch.py, tools/frida_mod_truth.py
|
probe scripts: print the mod a banner shows, or watch the banner and poll the mod arrays in one attach with a verdict |
tools/overlay/ |
out-of-process overlay for unpatched clients |
ThreadingHTTPServer speaking haxe.remoting (__x in, hxr + serialized out), logging each request raw and decoded.
python3 mock_appserver.py 8096
The working login configuration is built in, so no environment is required: a bare launch answers
startSession with the datastore entity and template (1105 bytes). GUL_BIND (default 0.0.0.0),
GUL_BASE (default http://127.0.0.1:8096), GUL_LOG, and the reply-shape knobs are documented in the
module docstring; set any of them to A/B-test an alternative reply. GUL_BIND=0.0.0.0 listens on every
interface and the mock has no authentication, so use GUL_BIND=127.0.0.1 on an untrusted network.
On Windows the same names work with set. The branch-B datastore reply is what lets the client seed its
store; GUL_DSUR_B_OPS selects which ops get it, and GUL_DSUR_HX_TEMPLATE=0 drops the template.
Structure:
-
HANDSHAKE— thedoHandshakeconfig, includingm_drmas anHxEnum. -
SESSION_CTX— the session context and account record (pluspgsToken); merged fromGUL_CTX_EXTRA, reduced byGUL_CTX_MINIMAL, fields dropped byGUL_CTX_DROP. -
PGS_PARTY— the generic party blob. -
OP_REPLIES— 19 named ops. Anything else receiveshandshake_result_dsur(None), a generic success. -
_dsur(payload)— branch A by default, branch B whenGUL_DSUR_Bis set or the current op is inGUL_DSUR_B_OPS. -
do_POST— routes/remoting/<conn>/<op>, the JSON legs, and the{}catch-all.
Knobs:
| group | variables |
|---|---|
| transport |
GUL_BASE, GUL_BIND, GUL_COMPRESS (none/zlib/raw/raw4), GUL_LOG_REQ
|
| handshake |
GUL_M_DRM, GUL_M_DRM_ARG, GUL_SERVER_ENV, GUL_COOLDOWN
|
| session |
GUL_CTX_MINIMAL, GUL_CTX_EXTRA, GUL_CTX_DROP, GUL_CTX_PROVIDER_ENUM, GUL_CTX_PROVIDER_IDX, GUL_RCONF
|
| branch B |
GUL_DSUR_B, GUL_DSUR_B_OPS, GUL_DSUR_DIRECT, GUL_DSUR_DIRECT_OPS, GUL_DSUR_DIRECT_VALUE
|
| entities |
GUL_DSUR_ENTITIES, GUL_DSUR_ENTITIES_STR, GUL_DSUR_ENTITIES_RAW, GUL_IID, GUL_IID_TEMPLATE, GUL_DSUR_BLOB_JSON, GUL_DSUR_BLOB_RAW, GUL_DSUR_BLOB_INTMAP
|
| PGS |
GUL_HEARTBEAT_SEC, GUL_USER_WATCH_STAMP, GUL_USER_WATCH_HOLD, GUL_PGS_ACCOUNTS
|
| replay |
GUL_TRACK_PUSH_PLAYER, GUL_TRACK_DELAY
|
The _RAW knobs take wire text, not JSON. Passing ["x"] emits literal brackets, rejected by the client with Invalid char [ at position 140.
Wire-format serializer/deserializer and builders.
- Tokens:
n t f z i d k m p y R o g a h u r x b h. -
Serializer.value(): dict → anonymous object or StringMap; list → array withu<n>null runs;str→y<len>:;HxEnum→w…;HxClass/HxInstance→ declarations +T<idx>:. -
RawFragmentsplices verbatim wire text. It is astrsubclass, so its check precedes the String branch. -
handshake_response(config)—[V decl][Result.Success(T0 instance)]. -
handshake_result_dsur(config)—[n][Result.Success(DSUR)], the universal accepted form. -
dsur_branch_b(config, entities, blob, extra_classes)—[n][Result.Success(DSUR)]with non-emptyupdatedEntities; emits the enum prefix first so the string table cannot shift. -
result_success(value)—[n][Result.Success(value)]without a DSUR wrapper.
Limitations: Unserializer does not implement w; r object references are not emitted.
The hxInflate writer (Deflater.hx grammar) and a host-side reader mirroring Inflater.hx, validated by tests/test_hxinflate.py. Decl describes a class (name, base, version, custom, fields); Raw injects verbatim text. A payload is valid when it decodes to its declared length, the check behind the account template's 36-byte extent and the player template's 4,296-byte extent.
tools/pakdump.py — UE4 v3 pak reader: index listing and extraction.
python3 tools/pakdump.py <pak> info
python3 tools/pakdump.py <pak> list [--filter TEXT]
python3 tools/pakdump.py <pak> extract <path> --out <dir>
tools/pak_patch_url.py — same-length in-place URL patcher. Layout:
footer 44 B at EOF-44: magic 0x5A6F12E1, version, index_offset, index_size, sha1
index: FString mount, u32 count, then per entry
FString path, u64 offset, u64 size, u64 csize, u16 method, u16 flags, sha1, 5 zero bytes
on-disk per-file header 53 B at entry.offset: same fields
compression none (v3), no encryption
Replaces every OLD with NEW (equal length); refreshes affected entries' sha1 in the index and on-disk header, and the footer index sha1. Reversible by swapping the arguments.
python3 tools/pak_patch_url.py ".../hns-WindowsNoEditor.pak" \
'https://api.playstreamline.com' 'http://127.0.0.1:8096/////////'
Trailing slashes pad to the original length; the client's URL join supplies the rest.
| tool | purpose |
|---|---|
tools/fix_pe_checksum.py |
MS checksum: zero PE+0x58, 16-bit LE sum with carry fold, add file length once. --check prints stored/computed/delta and exits non-zero on mismatch; without it the field is rewritten |
tools/u16scan.py |
UTF-16LE printable-run extraction, filtered by endpoint/keyword patterns |
tools/unwind.py, tools/stackscan.py, tools/throwscan.py
|
unwind metadata, stack-frame scanning, throw-site scanning over the shipped binary or a minidump |
VA ↔ file offset: .text −0xC00, .rdata −0xE00 (PatchIndex). A 32-bit address in a listing is an RVA; image base 0x140000000.
python3 tests/run_all.py
No pytest or game files; discovers unittest classes and module-level test_* functions, drives mock_appserver.py on ephemeral ports, and reports one total with 0 failed when green.
| test | covers |
|---|---|
test_haxe_ser_decode |
captured request bodies, token coverage |
test_hxinflate |
writer/reader symmetry, header, IntMap, null runs |
test_mock_branch_b |
branch A/B envelopes, entity-only contract, template negative control |
test_tpl_entity_payload |
the player template entity body |
test_login_gate_contract |
session context, playerIID, seven-value body (eight-value trailer tolerated) |
test_tracking_reply |
the postTrackingInfo reply shape |
test_unknown_op |
generic-success fallback |
test_process_url |
the processUrl reply literal and UrlAction variant |
test_user_watch_pacing |
user-watch long poll and stamp behaviour |
The mock allocates one identity per login (Player1, Player2, …), keyed by the client's session id
or cookie rather than its address, and keeps it stable across that session's operations. GUL_IID and
GUL_NAME pin a fixed value for single-client tests; GUL_NAME_PREFIX changes the auto prefix.
Generated from tools/patch_client.py; the tool is authoritative if this table drifts, and
scripts/check_patch_matrix.py fails when it does. A site named …_hook is a byte patch at a site; a cave is
the injected stub space it jumps into.
| profile | byte sites | caves |
|---|---|---|
all-cosmetics |
cosmetic_clear_skip, cosmetic_nullid_hook, cosmetics_all, drm_entry_a, drm_entry_b, drm_entry_c, no_loading_screen
|
cosmetic_nullid_cave, drm_cave
|
all-cosmetics-equip |
cosmetic_clear_skip, cosmetic_nullid_hook, cosmetics_all, drm_entry_a, drm_entry_b, drm_entry_c, equip_oob_hook, equip_own_hook, no_loading_screen, singleton_iid
|
cosmetic_nullid_cave, drm_cave, equip_fatal_cave, equip_own_cave
|
client |
drm_entry_a, drm_entry_b, drm_entry_c
|
drm_cave |
home-model |
cosmetic_clear_skip, drm_entry_a, drm_entry_b, drm_entry_c
|
drm_cave |
host |
activate_server_ret, contestants_phase, forced_registered, gate5b_nop, identity_hook, inactivity_kick_ret, login_retain, login_startplay_gate, loop3_hook, matchover_s2, pawn_restart_allow, prelogin_nohost, prelogin_session, register_server_skip, round_timer_hook, send_match_data_bypass, send_match_data_post_skip, set_player_defaults_skip, startlogin_skip, wait_two
|
identity_cave, loop3_cave, round_timer_cave
|
host-min |
activate_server_ret, forced_registered, gate5b_nop, inactivity_kick_ret, login_retain, login_startplay_gate, matchover_s2, pawn_restart_allow, prelogin_nohost, prelogin_session, register_server_skip, send_match_data_bypass, send_match_data_post_skip, set_player_defaults_skip, startlogin_skip, wait_two
|
— |
host-play |
activate_server_ret, contestants_phase, cosmetic_clear_skip, drm_entry_a, drm_entry_b, drm_entry_c, forced_registered, gate5b_nop, identity_hook, inactivity_kick_ret, login_retain, login_startplay_gate, loop3_hook, matchover_s2, no_loading_screen, pawn_restart_allow, prelogin_nohost, prelogin_session, register_server_skip, round_timer_hook, send_match_data_bypass, send_match_data_post_skip, set_player_defaults_skip, startlogin_skip, wait_two
|
drm_cave, identity_cave, loop3_cave, round_timer_cave
|
host-mod |
activate_server_ret, contestants_phase, cosmetic_clear_skip, drm_entry_a, drm_entry_b, drm_entry_c, forced_registered, gate5b_nop, identity_hook, inactivity_kick_ret, login_retain, login_startplay_gate, loop3_hook, matchover_s2, no_loading_screen, pawn_restart_allow, prelogin_nohost, prelogin_session, register_server_skip, round_timer_hook, send_match_data_bypass, send_match_data_post_skip, set_player_defaults_skip, startlogin_skip, wait_two, mod_apply_hook` |
drm_cave, identity_cave, loop3_cave, round_timer_cave, mod_apply_cave` |
play |
cosmetic_clear_skip, drm_entry_a, drm_entry_b, drm_entry_c, no_loading_screen
|
drm_cave |
tools/verify_server.py is a conformance check for any server, not just this repo's mock:
python3 tools/verify_server.py --base http://127.0.0.1:8096
It sends the legs the client actually sends — /remoting/appserver/doHandshake and startSession, the auth
check, the user resource, the user watcher, and parties/create — and asserts the shape each reply must
have: an hxr envelope carrying a model.Result, a JSON body token, a non-empty users array with an
integer update_stamp, and a party with an id and owner. Exit 0 when every leg passes, 1 when one does
not, 2 when the base URL is unreachable. It is deliberately shallow: it answers "does this server belong in
front of the client?", not "is every reply byte-perfect".