Skip to main content
Glama
README.md
# rea-client

> Client-app reverse engineering module — an MCP server + CLI for static triage of APK, IPA, Electron, and Mach-O artifacts.

REA([morluto/rea](https://github.com/morluto/rea))证明了「Agent + 逆向工具」的工作流可行。**rea-client** 把其中**客户端 App**这一块抽成零依赖模块:不启动目标、不反编译,只做可复现的静态分诊,把「下一步该看哪里」交给 Agent 和外部工具。

```text
Agent / CLI ──▶ rea-client (MCP) ──▶ 分诊结果:格式 / 字符串 / 密钥 / 保护 / 熵
                                      │
                                      └─▶ 深挖:jadx · apktool · Hopper · Ghidra · Frida
```

零依赖 · Node >= 20 · 只读 · 输出 JSON。

## 能力

| 工具 | 输入 | 输出 |
|---|---|---|
| `triage` | 任意客户端产物 | 格式、magic、大小、SHA-256 |
| `analyze` | 同上 | 分诊 + 熵 + 密钥 + 保护标记(一次跑完) |
| `strings` | 文件 | ASCII / UTF-16LE 字符串 + 字节偏移 |
| `scan_secrets` | 文件 | 硬编码密钥、JWT、带认证 URL(预览脱敏) |
| `entropy` | 文件 | 整体与 64 KiB 分块 Shannon 熵 |
| `inspect_macho` | Mach-O | header、load commands、dylib、rpath、加密、代码签名 |
| `inspect_apk` | APK | dex、native libs、ABI、manifest、v1/v2+ 签名 |
| `inspect_app` | `.app` / `.ipa` | Info.plist、可执行文件、frameworks、entitlements、URL scheme、ATS |
| `detect_protections` | 文件 | 反调试 / 注入框架 / 壳 / root / 模拟器 标记 |

## 快速开始

```bash
git clone https://github.com/littleqian12/rea-client.git
cd rea-client
npm test

node bin/rea-client.js analyze /Applications/Some.app
node bin/rea-client.js triage ./app.apk
node bin/rea-client.js scan_secrets ./binary
node bin/rea-client.js inspect_macho ./binary
node bin/rea-client.js inspect_app ./Demo.app
```

输出示例(`triage /bin/ls`):

```json
{
  "path": "/bin/ls",
  "kind": "binary",
  "format": "macho-fat",
  "size": 154624,
  "sha256": "0056d8fd...",
  "magic": "cafebabe000000020100000700000003"
}
```

## 接入 MCP 客户端

Claude Desktop / Claude Code / Cursor 都可以直接注册为 stdio MCP server:

```json
{
  "mcpServers": {
    "rea-client": {
      "command": "node",
      "args": ["/absolute/path/rea-client/bin/rea-client.js", "serve"]
    }
  }
}
```

Claude Code:

```bash
claude mcp add rea-client -- node /absolute/path/rea-client/bin/rea-client.js serve
```

之后可以直接说:

```text
分析这个 APK 的签名和保护措施:/tmp/app.apk
看看这个 macOS App 用了哪些 dylib,有没有关闭库校验:/Applications/Foo.app
这个二进制里有没有硬编码密钥:/tmp/libfoo.dylib
```

## 设计边界

- **静态只读**:不运行目标,不加载 dylib,不执行 dex。
- **不做反编译**:dex/JS 反编译交给 jadx/apktool/asar;本模块负责「先看哪里」。
- **启发式**:字符串命中不等于恶意,熵高不等于加壳。
- **只扫前 256 MiB**:超大文件会标记 `truncated`。
- **不绕过保护**:检测反调试/壳的存在,但不提供绕过。

## 授权使用

仅分析你拥有或已获得书面授权的 App。不要用它绕过 DRM、破解付费功能或规避反作弊。本项目的定位是安全评估、兼容性研究、恶意样本分诊。

## 文档

- [原理与边界](docs/原理与边界.md)

## License

Apache-2.0