# wmpf-offset-adaptation-skill **Repository Path**: viying/wmpf-offset-adaptation-skill ## Basic Information - **Project Name**: wmpf-offset-adaptation-skill - **Description**: wmpf-offset-adaptation 逆向wx的偏移量skills - **Primary Language**: Unknown - **License**: AGPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2026-07-22 - **Last Updated**: 2026-07-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # wmpf-offset-adaptation X Debugger 的 Frida 偏移适配 Skill,覆盖两个平台: | 平台 | 目标模块 | 配置路径 | 脚本 | |------|----------|----------|------| | **Windows** | WMPF `flue.dll` | `frida/config/addresses.{version}.json` | `scripts/extract_wmpf_offsets.py` | | **macOS** | `WeChatAppEx Framework`(ARM64) | `frida/config/macos/addresses.{version}.json` | `scripts/extract_macos_offsets.py` + `scripts/macos/resign-wechatappex.sh` | 适用于 [X Debugger](https://github.com/ghostmice/x-debugger) / [WMPFDebugger](https://github.com/evi0s/WMPFDebugger) / [WMPFDebugger-arm](https://github.com/chain00x/WMPFDebugger-arm)。 ## 安装(Cursor Agent Skill) ```bash # 个人全局 # Windows: %USERPROFILE%\.cursor\skills\wmpf-offset-adaptation\ # macOS/Linux: ~/.cursor/skills/wmpf-offset-adaptation/ # 或仅当前项目 cp -r wmpf-offset-adaptation-skill/wmpf-offset-adaptation .cursor/skills/ ``` 目录结构: ``` wmpf-offset-adaptation/ ├── SKILL.md ├── reference.md # Windows PE / .pdata ├── reference-macos.md # macOS Framework / idalib / SIP ├── scripts/ │ ├── extract_wmpf_offsets.py │ ├── extract_macos_offsets.py │ └── macos/ │ ├── resign-wechatappex.sh │ └── wechatappex-resign.entitlements └── (发布包另含 examples/) ``` 复制后**重启 Cursor**。 ## 依赖 | 平台 | 依赖 | |------|------| | Windows 脚本 | `pip install pefile capstone` | | macOS prepare | 系统自带 `lipo` / `plutil` | | macOS idalib | IDA Pro + Hex-Rays + idalib | | macOS 注入 | `csrutil disable` + resign 脚本 | --- ## Windows:快速使用 ```bash python scripts/extract_wmpf_offsets.py --version 25047 python scripts/extract_wmpf_offsets.py --version 25047 --dll "C:\...\flue.dll" python scripts/extract_wmpf_offsets.py --version 25047 --write --config-dir path/to/frida/config ``` 示例:[`examples/windows/addresses.25047.json`](examples/windows/addresses.25047.json)。 验证:重启调试器 → `script loaded` → 再开小程序 → `devtools://devtools/bundled/inspector.html?ws=127.0.0.1:62000` --- ## macOS:快速使用 ### 1. 偏移提取 ```bash # 探测版本 + lipo ARM64 thin + draft JSON(无需 IDA) python scripts/extract_macos_offsets.py python scripts/extract_macos_offsets.py --prepare-only --work ./.ida-work-macos # 有 idalib:半自动提取(SceneOffsets / CDP 务必人工复核) python scripts/extract_macos_offsets.py --idalib \ --binary ./.ida-work-macos/WeChatAppEx_Framework_arm64_ \ --write --config-dir path/to/nebula-tauri/frida/config/macos ``` 无 idalib 时:用 IDA 打开 thin 二进制,按 `SKILL.md` §B / `reference-macos.md` 手工填五项偏移。 | 字段 | 定位要点 | |------|----------| | `LoadStartHookOffset` | OnLoadStart / `applet_index_container.cc` 入口 | | `SceneHookOffset` | OnLoadStart 尾部 `if ((_DWORD)a2) return unk_...` | | `SceneOffsets` | SceneHook 内比较 `1101` 的四级链(十进制) | | `CDPFilterHookOffset` | `SendToClientFilter` 父函数里 `v[2]!=6` 的 filter callee | | `ResourceCachePolicyHookOffset` | `WAPCAdapterAppIndex.js` 首处有效 xref 函数入口 | 示例:[`examples/macos/addresses.4.1.11.80.json`](examples/macos/addresses.4.1.11.80.json)(另有 `4.1.0.240`、`4.1.5.17`,**不可跨版本照搬**)。 ### 2. 注入前提(必须) Apple 签名 + Hardened Runtime → Frida 会触发 `SIGKILL (Code Signature Invalid)`。 ```bash # 恢复模式 csrutil disable # 然后重启 # 本机 resign(去掉 runtime,加 disable-library-validation) ./scripts/macos/resign-wechatappex.sh # 或 nebula-tauri 内同名脚本 ``` 仅 `csrutil enable --without debug` **不够**。微信更新后需重新 resign。 ### 3. 验证 1. 开微信 → 任意小程序(拉起 WeChatAppEx) 2. 启动调试 → 日志四条 `attached at` / `hooks ready` 3. Chrome:`devtools://devtools/bundled/inspector.html?ws=127.0.0.1:62000` --- ## 示例与字段差异 ``` examples/ ├── windows/addresses.25047.json └── macos/ ├── addresses.4.1.0.240.json ├── addresses.4.1.5.17.json └── addresses.4.1.11.80.json ``` | 差异 | Windows | macOS | |------|---------|-------| | `Version` | 整数 WMPF 号 | 字符串 `WeChatBundleVersion` | | 字段 | LoadStart / CDP / SceneOffsets(6) | + SceneHook / Resource / ModuleName;SceneOffsets(4) | | 自动化 | PE `.pdata` 较完整 | prepare + idalib 半自动,CDP/Scene 需复核 | ## 文件说明 | 文件 | 说明 | |------|------| | `SKILL.md` | Agent 技能主文件(§A Windows / §B macOS) | | `reference.md` | Windows 算法 | | `reference-macos.md` | macOS 算法与 SIP | | `scripts/extract_wmpf_offsets.py` | Windows | | `scripts/extract_macos_offsets.py` | macOS prepare / idalib | | `scripts/macos/resign-wechatappex.sh` | 注入前 resign | ## License 仅供学习与研究使用。