il2cpp: symbolize decomp, resolve fields/enums, Ghidra apply-plan, Frida hooks - #15
Merged
Merged
Conversation
…ida hooks
Four comprehension features on top of the Ghidra package, all reusing the
generated script.json / dummy DLLs (CLI -m il2cpp + MCP):
1. Symbolize (Il2CppDecompCleaner): rewrite Ghidra's FUN_/DAT_/PTR_ address
symbols to managed names from script.json, so a raw decompilation reads with
real names without applying anything in Ghidra. Folded into --il2cpp-clean.
2. Field + enum resolver (Il2CppTypesJson + Il2CppSymbolIndex): a new
il2cpp_types.json (field offsets + enum value maps, extracted from the Cpp2IL
dummy DLLs via Cecil, cached and shipped in the package) powers --il2cpp-field
(offset -> field name/type) and --il2cpp-enum (value -> constant, with flag
decomposition).
3. Ghidra apply-plan (--il2cpp-apply-plan): emit a {va, name, prototype} batch,
optionally name-filtered, to drive rename + set-prototype via the Ghidra MCP
without re-running the whole ghidra.py.
4. Frida hooks (Il2CppFridaGenerator, --il2cpp-frida): generate a ready-to-run
Frida script that hooks matching methods by RVA (resolves module base itself)
and logs typed args/return; written to <output>/il2cpp/hooks.js.
MCP: il2cpp_field, il2cpp_enum, il2cpp_frida, il2cpp_apply_plan; il2cpp_clean now
symbolizes. Server 0.6.0. Docs updated. Managed compile passes (local build's only
failure is the pre-existing native FBX copy step).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Four comprehension features that turn raw Ghidra output into meaning, plus a runtime dimension. All reuse data UnityRift already generates (
script.json, the Cpp2IL dummy DLLs) — exposed via CLI (-m il2cpp) and MCP.Features
1. Symbolize decompilation (
--il2cpp-cleannow does this)Rewrites Ghidra's
FUN_/DAT_/PTR_address symbols to managed names fromscript.json, so a raw decompilation reads with real names without applying anything in Ghidra. Combined with the existing boilerplate-strip + constant annotation.2. Field + enum resolver (
--il2cpp-field,--il2cpp-enum)New
il2cpp_types.json— per-type field offsets and enum value maps extracted from the dummy DLLs via Mono.Cecil ([FieldOffset]+ enum consts), cached and shipped in the package. Turns*(int *)(param_1 + 0x24)into a field name/type andif (state == 3)into an enum constant (with flag decomposition).3. Ghidra apply-plan (
--il2cpp-apply-plan <regex|*>)Emits a
{va, name, prototype}batch, optionally name-filtered, to driverename_function/set_function_prototypethrough the Ghidra MCP — so names/types can be applied to a targeted subset instead of re-running the wholeghidra.py.4. Frida hook generator (
--il2cpp-frida <name|0xRVA>)Generates a ready-to-run Frida script that hooks matching methods by RVA (resolves the module base itself, ASLR-safe) and logs typed args/return, with an IL2CPP
System.Stringreader helper. Written to<output>/il2cpp/hooks.js. Confirms at runtime what a statically-reversed method actually does.Why
The static package nails what the code is. These add the iterative comprehension layer: read names inline, resolve pointer math and enum comparisons, apply names surgically in Ghidra, and verify behaviour dynamically.
Notes for reviewer
Il2CppTypesJson(Cecil,#if !NETFRAMEWORK, matching the existing IL2CPP gating).il2cpp_types.jsonis built once (cached) from the dummy DLLs and added to the exported package + its README.il2cpp_field,il2cpp_enum,il2cpp_frida,il2cpp_apply_plan; server bumped to 0.6.0.UnityRiftFBXNative.dllpost-build copy (runnable binaries come from CI).[FieldOffset]/enum extraction is best-effort against the documented Cpp2IL attribute shape and should get a smoke test on a real target.