MCPcopy Index your code
hub / github.com/axhlzy/Il2CppHookScripts

github.com/axhlzy/Il2CppHookScripts @V2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release V2.0 ↗ · + Follow
3,199 symbols 5,642 edges 197 files 234 documented · 7%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Il2cppHook

基于 frida 的 libil2cpp.so 运行时解析脚本

特性

  • 解析 Unity 的方法 / 类 / 字段
  • 解析 运行时 方法参数
  • 常用函数的 (批量)断点(参数值 / 返回值 查看)

使用

$ git clone https://github.com/axhlzy/Il2CppHookScripts.git
$ cd Il2cppHook/
$ npm install
$ frida -U --no-pause -f com.xxx.xxx -l  ../_Ufunc.js

API

目录
  1. 获取基本信息
  2. 断点函数
  3. 常用函数Hook的封装

...


  • i() == list_images 列出所有的 Images

    list_images

  • c() == list_classes 列出所有的 Classes

    list_classes

  • m() == list_methods 列出所有的 Methods

    list_methods

  • f() == list_fields 列出所有的 Fields

    list_fields

  • findClass(className) 查找类,一般配合 m() 使用 , m(findClass('className')) === m('className')

    findClass

  • findMethod 新版 / find_method 旧版

    findMethod

  • printExp 作为findMethod的补充版,方便查找函数

    • 第一个参数是查找的函数名 findMethod
    • 第二个参数标识是否全局查找(默认在常用的函数中查找,因为是遍历嘛,这样可以有效提高查找速度) findMethod
  • getApkInfo 获取 apk 信息

    getApkInfo

  • B breakPoint 断点函数类

  • B ('ClassName') === B(findClass('ClassName')),不会重复添加已添加的Method,不带参数即断点所有常用的方法

    breakPoint_B

  • b ('Method_Pointer') / b('MethodInfo_Pointer')

    breakPoint_b

  • d / D : d === detachAll and d(ptr) === detach(ptr) / D() === detachAll + clear list cache

  • n/nn nop Function

  • n / nn : n(ptr) === nop function and nn() === cancel nop function

    nop

  • breakInline InlineHook

    breakInline

  • breakWithArgs 带参数断点

    breakWithArgs

  • breakWithStack 带堆栈断点

    breakWithStack

  • watch/watchDisabled MemoryAccessMonitor的简单封装(arm32易崩)

    watch

  • HookOnPointerClick :Hook 点击事件

    HookOnPointerClick

  • HookDebugLog : Hook Debug.Log

    HookDebugLog

  • HookSetActive : Hook SetActive

    HookSetActive

...

Commit

  • 文件结构按照Unity类继承关系实现
  • 文件命名规则以及结构
  • 一个类文件夹下一个include.ts包含当前类文件以及该类子类文件夹的include
  • api.ts
    • 用作解析常用函数 (exp: ptr(Il2Cpp.Api.Application._Quit) )
    • 函数的命名使用 '_' + 具体的函数名,多参数使用后缀 '_x' 结尾i (exp: Il2Cpp.Api.Application._Quit_1)
    • api class 命名为 类名 + 'API'
  • class.ts
    • NativePointer转换为Class的实现 (把ptr当成class来解析)
    • 包含一些(静态)字段,(静态)方法,以及方便调用的一些函数封装
    • this.handle 存贮当前 ptr,可以是 实例指针也可以是类指针 (多数情况使用实例指针)
  • export.ts
    • 主要用作拓展类的一些导出方法
  • TODO 按照这个文件结构可以拓展到整个UnityAPI

Extension points exported contracts — how you extend this code

mscorlib_System_Object (Interface)
(no doc) [3 implementers]
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/interface.ts
ResourcesAPI_interface (Interface)
(no doc) [3 implementers]
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/ResourcesAPI/interface.ts
Il2cppColor (Interface)
(no doc) [3 implementers]
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/ValueType/Color/interface.ts
Il2cppQuaternion (Interface)
(no doc) [3 implementers]
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/ValueType/Quaternion/interface.ts
PlayerPrefs_Interface (Interface)
(no doc) [3 implementers]
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/PlayerPrefs/interface.ts

Core symbols most depended-on inside this repo

toString
called by 167
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/interface.ts
LOGD
called by 166
Il2cppHook/agent/utils/logger.ts
LOGD
called by 164
Il2cppHook/_Ufunc.js
isNull
called by 144
Il2cppHook/_Ufunc.js
r
called by 138
Il2cppHook/_Ufunc.js
set
called by 105
Il2cppHook/_Ufunc.js
get
called by 90
Il2cppHook/_Ufunc.js
getLine
called by 70
Il2cppHook/agent/utils/logger.ts

Shape

Method 2,329
Class 456
Function 373
Interface 21
Enum 20

Languages

TypeScript100%

Modules by API surface

Il2cppHook/_Ufunc.js1,638 symbols
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/SystemInfo/api.ts62 symbols
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/AbstractEventData/BaseEventData/PointerEventData/api.ts49 symbols
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/AbstractEventData/BaseEventData/PointerEventData/class.ts48 symbols
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/Object/Component/Transform/class.ts46 symbols
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/Application/class.ts46 symbols
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/AbstractEventData/BaseEventData/PointerEventData/interface.ts43 symbols
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/Application/api.ts41 symbols
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/Object/Component/Transform/interface.ts40 symbols
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/Object/Component/Transform/api.ts37 symbols
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/SystemInfo/class.ts31 symbols
Il2cppHook/agent/expand/TypeExtends/mscorlibObj/Object/GameObject/class.ts28 symbols

For agents

$ claude mcp add Il2CppHookScripts \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact