Add ImGui GUI, full type extraction, bidirectional packet injection
Major additions: - ImGui GUI (paralogue_gui.py) with 6 tabs: Packets, Config, Session, Wire, Dispatch, Composer. Real-time packet inspector with JSON syntax highlighting via imgui_color_text_edit. Modifier toggles with auto-save. - Full msg_id -> type extraction via Frida GetTypeName() on all 191 dispatch entries (extract_type_names.js, run_extract_types.py). Zero unknowns remaining. - Bidirectional WireRewriter: C->S rewriter enables packet injection without breaking server decrypt counter. Write locks prevent interleaved frame corruption. - Packet injection: replay captured packets or compose custom ones from the GUI Composer tab. S->C uses packet_id=0 (push semantics), C->S auto-increments. - Direction enforcement in _emit_decoded: rejects type names whose suffix contradicts wire direction, purges stale cache entries. - Blueprint injection modifier (11xxx range) as separate toggle. - build_frame() helper for constructing wire frames from msg_id + body. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
9c3189cac2
commit
d7799f51a7
11 files changed
+2304
-73
No files matched your search
+229
@@ -1325,3 +1325,232 @@ frida_hooks\run_mitm.bat --inject-items
|
||||
# Login, open a single blueprint -> entire experiment range unlocks
|
||||
# in the client UI.
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Session 2026-04-16 — full type extraction, GUI, and open questions resolved
|
||||
|
||||
### Complete msg_id → type mapping via Frida + GetTypeName()
|
||||
|
||||
All 191 dispatch-table entries now have ground-truth protobuf type
|
||||
names. Resolved via a Frida script (`extract_type_names.js`) that:
|
||||
|
||||
1. Walks the dispatch hash table (same as `dispatch_dump.js`).
|
||||
2. For each entry, reads the **factory pointer** from
|
||||
`entry + 8` → dereferences to get the factory's **vtable**.
|
||||
3. Calls **`vtable[2]`** (offset 16) = `New(factory, NULL)` to
|
||||
heap-allocate a fresh message instance.
|
||||
4. Calls **`vtable[1]`** (offset 8) = `GetTypeName(this, &out_str)`
|
||||
on the new message. This is Google protobuf's
|
||||
`Message::GetTypeName()` which internally calls
|
||||
`GetMetadata() → Descriptor → full_name()`.
|
||||
5. Reads the returned MSVC `std::string` (SSO-aware: if capacity < 16
|
||||
the buffer is inline at offset 0, otherwise a heap pointer).
|
||||
6. Strips the `"ParalogueNet."` prefix.
|
||||
|
||||
The calling convention detail that made this work: vtable slot 1 is
|
||||
a **thiscall** (`rcx = this`, `rdx = &output_string`), NOT an sret
|
||||
return. The function writes into the `std::string` pointed to by
|
||||
`rdx` and returns `rdx`. Passing the args in the wrong order caused
|
||||
an access violation at offset `0x80` (the internal
|
||||
`GetMetadata()` call reading vtable slot 16).
|
||||
|
||||
The `New()` call (vtable slot 2) takes `(factory, arena)` where
|
||||
factory = `this` (the default_instance), arena = NULL for heap
|
||||
allocation. Passing NULL as both arguments caused the factory to
|
||||
be treated as an arena, which crashed.
|
||||
|
||||
Result: `dispatch_type_names.json` with all 191 entries. Persisted
|
||||
to `known_msg_ids.json` (192 entries total) and
|
||||
`factory_to_type.json` (191 vtable→name entries).
|
||||
|
||||
### Earlier approach: _InternalSerialize string scanning
|
||||
|
||||
Before discovering the GetTypeName vtable slot, we tried scanning
|
||||
each class's `_InternalSerialize` function (vtable slot 10, offset 80)
|
||||
for RIP-relative LEA instructions referencing field-verification
|
||||
strings like `"ParalogueNet.PlayerLoginRsp.region_name"`.
|
||||
|
||||
This worked for 65 out of 191 types (those with string fields in
|
||||
their proto schema). The remaining 96 types had no string fields
|
||||
(numeric-only bodies like `{status: 1}`) so their serializers
|
||||
contained no string references. Also produced 30 false positives
|
||||
for `PatreonBoundResultS2C` — trivial response functions sharing a
|
||||
code path that happened to reference that string.
|
||||
|
||||
The GetTypeName approach superseded this by resolving all 191.
|
||||
|
||||
### Key corrections from the extraction
|
||||
|
||||
| msg_id | old (heuristic/strict) | **ground-truth** |
|
||||
|---|---|---|
|
||||
| 1005 | `<unknown>` | **PlayerMainDataReq** |
|
||||
| 1007 | `KickPlayerS2C` | **PlayerPingReq** |
|
||||
| 1008 | `PlayerTimeOffsetS2C` | **PlayerPingRsp** |
|
||||
| 1013 | `KickPlayerS2C` | **GmCodeReq** |
|
||||
| 1017 | `AchievementEntry` | **GetMailsReq** |
|
||||
| 1024 | (unpinned) | **PlayerTimeOffsetS2C** |
|
||||
| 1032 | `RoleDilationUpdateS2C` | **UeGetRoomRsp** |
|
||||
| 1082 | (unpinned) | **GetAchievementRewardReq** |
|
||||
| 1200 | `ClothesPresetUpdateS2C` | **RoleAttrUpdateS2C** |
|
||||
| 1211 | (unpinned) | **RoleDilationUpdateS2C** |
|
||||
| 1236 | (unpinned) | **KickPlayerS2C** (the real one!) |
|
||||
|
||||
The old `KickPlayerS2C` at msg_id 1007 was a long-standing
|
||||
misidentification — the real KickPlayerS2C is msg_id 1236.
|
||||
|
||||
### Direction enforcement in _emit_decoded
|
||||
|
||||
Added `_name_direction_mismatch(name, direction)` that rejects
|
||||
type names whose suffix contradicts the packet's wire direction:
|
||||
- C->S packets must not be named `*S2C` or `*Rsp`
|
||||
- S->C packets must not be named `*C2S` or `*Req`
|
||||
|
||||
When a mismatch is detected:
|
||||
1. The stale entry is **purged from `msg_id_cache`** and saved to
|
||||
disk (preventing re-contamination when other pins trigger a
|
||||
`save_known_ids` call).
|
||||
2. The `preferred` hint passed to `identify_body` is cleared.
|
||||
3. A direction-compatible strict candidate is picked instead.
|
||||
|
||||
### UE Dumper-7 data
|
||||
|
||||
The project includes a Dumper-7 extraction at
|
||||
`dumper/Dumped/5.5.4-0+UE5-Paralogue/` with:
|
||||
- `GObjects-Dump.txt` (110K lines) — all UE objects
|
||||
- `GObjects-Dump-WithProperties.txt` — with field details
|
||||
- `CppSDK/` — generated C++ headers
|
||||
- `Dumpspace/ClassesInfo.json` — 6064 UE classes
|
||||
|
||||
Key finding: `UProtobufMessage` (in `ProtobufBlueprintSp` package)
|
||||
has an `Identify` int32 field at offset 0x28 and a static
|
||||
`InitIdentifyMap()` function. But protobuf message types are NOT
|
||||
UE subclasses — they're Google C++ protobuf classes. The
|
||||
`InitIdentifyMap()` populates a runtime `TMap<int32, UClass*>` at
|
||||
startup. The Frida GetTypeName approach was more direct than trying
|
||||
to hook Blueprint byte-code.
|
||||
|
||||
### ImGui GUI (`paralogue_gui.py`)
|
||||
|
||||
Built a desktop GUI using `imgui_bundle` (Dear ImGui for Python):
|
||||
|
||||
**Architecture:**
|
||||
- Main thread: imgui render loop at ~60fps
|
||||
- Background daemon thread: asyncio event loop running the proxy
|
||||
- `SharedState` bridges the two (deque for packets, Lock for config)
|
||||
- `GUISession(Session)` subclass mirrors data into SharedState
|
||||
|
||||
**5 tabs:**
|
||||
1. **Packets** — real-time table with direction/source filters,
|
||||
click to expand detail pane with Tree/JSON/Hex sub-tabs.
|
||||
JSON tab uses `imgui_color_text_edit.TextEditor` with JSON
|
||||
syntax highlighting and monospace code font.
|
||||
2. **Config** — per-modifier toggles (card expand, blueprints,
|
||||
role attrs, items, unlock functions) with parameter sliders.
|
||||
Auto-saves to `gui_config.json` on change.
|
||||
3. **Session** — key/nonce, PID, Frida status (color-coded),
|
||||
proxy ports, dispatch summary, action buttons (Restart Frida,
|
||||
Launch Game via Steam URL).
|
||||
4. **Wire** — raw hex traffic with timestamp and direction.
|
||||
5. **Dispatch** — all 191 entries with msg_id, vtable, type name,
|
||||
pinned status. Green = resolved, red = unknown.
|
||||
|
||||
**Modifier toggles (Config tab):**
|
||||
- Card Bag Expand — rewrites `CardBagOpenRsp.rets` to 0..2000
|
||||
- Inject Blueprints — adds 11000..11999 to `BagItemFullS2C`
|
||||
- Unlock Functions — populates `PlayerMainDataRsp.unlockFunctions`
|
||||
- Role Attrs Saturate — sets all role `attrs` to 999, `is_unlock=True`
|
||||
- Inject Bag Items — dense fill across cloth/card/normal ranges
|
||||
|
||||
Modifiers **chain** (not first-wins) so multiple modifiers targeting
|
||||
the same msg_id all run in sequence.
|
||||
|
||||
**Frida lifecycle:**
|
||||
- "Restart Frida" button stops old bridge, clears scripts,
|
||||
re-attaches to current game PID.
|
||||
- "Launch Game (Steam)" calls `os.startfile("steam://rungameid/2701680")`.
|
||||
- Background poller updates PID + Frida status every second.
|
||||
- `WireRewriter` resets per TCP connection (not per session).
|
||||
|
||||
### Protobuf JSON rendering
|
||||
|
||||
Packet detail pane now uses `google.protobuf.json_format.MessageToJson()`
|
||||
for definitive rendering. For a `RoleListFullS2C` body this produces:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "StatusCode_OK",
|
||||
"role_list": {
|
||||
"curr_role_name": "Galatea",
|
||||
"roles": [
|
||||
{
|
||||
"name": "Celia",
|
||||
"is_unlock": false,
|
||||
"worn_clothes": [{"id": 68}],
|
||||
...
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Previously, nested `Role` messages with string fields were misparsed
|
||||
as `ClothesColorCell` with packed-int arrays reading
|
||||
`[71,97,108,97,116,101,97]` = "Galatea" as integers.
|
||||
|
||||
The JSON tab uses `imgui_color_text_edit.TextEditor` with
|
||||
`LanguageDefinitionId.json` for syntax highlighting, rendered with
|
||||
`imgui_md.get_code_font()` for monospace display.
|
||||
|
||||
### Files added or modified this session
|
||||
|
||||
| file | change |
|
||||
|---|---|
|
||||
| `frida_hooks/paralogue_gui.py` | **new** — full ImGui GUI (~700 lines) |
|
||||
| `frida_hooks/extract_type_names.js` | **new** — GetTypeName Frida extraction |
|
||||
| `frida_hooks/dispatch_type_names.json` | **new** — all 191 msg_id→type mappings |
|
||||
| `frida_hooks/gui_config.json` | **new** — persisted modifier toggles/params |
|
||||
| `frida_hooks/run_gui.bat` | **new** — GUI launcher |
|
||||
| `frida_hooks/paralogue_mitm.py` | added `run_with_session()`, `inject_blueprints_modifier`, `_name_direction_mismatch()`, direction enforcement |
|
||||
| `frida_hooks/paralogue_decoder.py` | no changes this session |
|
||||
| `frida_hooks/known_msg_ids.json` | updated to 192 entries (all ground-truth) |
|
||||
| `frida_hooks/factory_to_type.json` | updated to 191 entries (all vtable→name) |
|
||||
|
||||
### Remaining open questions
|
||||
|
||||
* **Vtable layout documentation**: vtable slot assignments for
|
||||
Google protobuf `Message` on MSVC x64:
|
||||
- [0] deleting destructor
|
||||
- [1] GetTypeName (thiscall, writes into rdx std::string)
|
||||
- [2] New(this, Arena*)
|
||||
- [4] IsInitialized
|
||||
- [5] ... (unclear)
|
||||
- [8] GetCachedSize
|
||||
- [9] _InternalParse
|
||||
- [10] _InternalSerialize
|
||||
- [16] GetMetadata (called internally by GetTypeName)
|
||||
Slots 3,5,6,7,11-15 not fully characterized.
|
||||
|
||||
* **Client-side item/card DataTable**: the static `UDataTable` asset
|
||||
that defines valid item/card IDs was not enumerated. Walking it
|
||||
would let us inject only IDs the client recognizes (eliminating
|
||||
the silent-filter problem). `GetItemTypeById` (sub_1448A2A70) is
|
||||
the entry point but the heavy logic is in Blueprint byte-code.
|
||||
|
||||
* **`Role.attrs` semantics**: keys 3, 58-69, 72-74 have varied
|
||||
values per role (e.g., Erika: 65=42, 67=33, 69=84, 72=3300)
|
||||
but saturating to 999 had no visible UI effect. Likely
|
||||
achievement/stat counters, not unlock flags.
|
||||
|
||||
### Quick-start with GUI
|
||||
|
||||
```
|
||||
cd X:\Users\user\fallendoll
|
||||
frida_hooks\run_gui.bat
|
||||
|
||||
# GUI launches → proxy starts → waits for game
|
||||
# Launch game via "Launch Game (Steam)" button or Steam client
|
||||
# Login → packets stream into Packets tab
|
||||
# Toggle modifiers in Config tab as needed
|
||||
# Restart Frida after game relaunch via Session tab button
|
||||
```
|
||||
Reference in new issue
Block a user