IL2CPP Frida MCP 服务器
A. 模型上下文协议(MCP) 基于IL2CPP的逆向工程工具,使AI助手(如Claude、Kiro)能够直接分析和操纵Unity IL2CPP应用程序。
特性
- 🔌 Frida整合 -支持USB、远程和本地设备连接
- 📦 IL2CPP分析 -列出支持模糊搜索的图像、类和方法
- 🔍 反汇编 -基于Frida指令API的方法反汇编
- 🧠 GC堆分析 -查找运行时对象实例
- 📤 导入/导出 -查找模块导入和导出功能
- 🛠️ JS执行 -执行任意JavaScript代码以操作Frida API
项目结构
.
├── mcp_server.py # Entry point
├── mcp_server/ # MCP Server module
│ ├── __init__.py
│ ├── server.py # MCP Server core
│ ├── state.py # Frida state management
│ ├── tools.py # MCP tool definitions
│ ├── transport.py # Transport layer (stdio/sse/http)
│ ├── cli.py # Command line interface
│ ├── agent_loader.py # Agent loader
│ └── handlers/ # Tool handlers
│ ├── __init__.py
│ ├── frida_handlers.py
│ └── il2cpp_handlers.py
├── agent/ # Frida Agent (TypeScript)
│ ├── index.ts # Agent entry point
│ ├── core/ # Core modules
│ │ ├── il2cpp-helper.ts
│ │ ├── method-utils.ts
│ │ └── class-finder.ts
│ └── services/ # Service modules
│ ├── image-service.ts
│ ├── class-service.ts
│ ├── method-service.ts
│ ├── disasm-service.ts
│ ├── module-service.ts
│ ├── gc-service.ts
│ └── exec-service.ts
├── _agent.js # Compiled Agent
├── package.json
├── tsconfig.json
└── requirements.txt安装
选项1:pip安装(推荐)
# Install from source
pip install .
# Or install in development mode
pip install -e .选项2:手动依赖项安装
pip install -r requirements.txt编译Frida代理
npm install
npm run build用法
启动MCP服务器
# If installed via pip
il2cpp-frida-mcp # Interactive selection
il2cpp-frida-mcp --stdio # stdio mode
il2cpp-frida-mcp --sse # SSE mode
il2cpp-frida-mcp --http # HTTP mode
# Or run script directly
python mcp_server.py --stdio
# Custom host and port
il2cpp-frida-mcp --sse --host 0.0.0.0 --port 9000配置MCP客户端
克劳德桌面/Kiro
添加到MCP配置文件中:
{
"mcpServers": {
"il2cpp-frida": {
"command": "il2cpp-frida-mcp",
"args": ["--stdio"]
}
}
}或者使用Python模块运行:
{
"mcpServers": {
"il2cpp-frida": {
"command": "python",
"args": ["-m", "mcp_server", "--stdio"]
}
}
}MCP工具
Frida基本工具
| 工具 | 说明 |
|---|---|
frida_list_devices | 列出所有可用的Frida设备 |
frida_connect | 连接到设备和目标进程 |
frida_disconnect | 断开Frida连接 |
frida_resume | 恢复暂停的进程 |
frida_list_processes | 列出设备上的进程 |
IL2CPP分析工具
| 工具 | 说明 |
|---|---|
il2cpp_list_images | 列出所有IL2CPP图像 |
il2cpp_list_classes | 列出指定图像中的所有类 |
il2cpp_list_methods | 列出指定类中的所有方法 |
il2cpp_show_method | 显示方法详细信息 |
il2cpp_find_classes | 查找类(支持模糊匹配) |
il2cpp_find_methods | 查找方法(支持模糊匹配) |
il2cpp_show_asm | 拆卸方法 |
il2cpp_find_export | 查找导出函数 |
il2cpp_find_import | 查找导入函数 |
il2cpp_exec_js | 执行任意JavaScript代码 |
il2cpp_gc_choose | 在堆中查找指定类的实例 |
il2cpp_gc_info | 获取GC堆信息 |
例子
1.连接到设备
Use frida_connect to connect to the frontmost app on USB device2.分析IL2CPP
List all images, then find classes containing "Player"3.查看方法详细信息
List all methods of PlayerController class, then view Update method details发展
编译代理
npm run build # Single build
npm run watch # Watch mode依赖项
- Python 3.10+
- Node.js 16+
- 弗里达17+
- frida-il2cpp-bridge
致谢
- frida-il2cpp-bridge -IL2CPP运行时桥
- Il2CppHookScripts -参考实施
许可证
麻省理工学院
