android-decompile-mcp 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,258 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # DexAndroid
2
+
3
+ **English** · [简体中文](./README.zh-CN.md) · [繁體中文](./README.zh-TW.md) · [日本語](./README.ja.md) · [한국어](./README.ko.md) · [Español](./README.es.md) · [Français](./README.fr.md) · [Deutsch](./README.de.md) · [Português](./README.pt-BR.md) · [Русский](./README.ru.md) · [العربية](./README.ar.md) · [हिन्दी](./README.hi.md) · [Bahasa Indonesia](./README.id.md) · [Tiếng Việt](./README.vi.md) · [ไทย](./README.th.md) · [Italiano](./README.it.md) · [Türkçe](./README.tr.md)
4
+
5
+ > ⚠️ **For learning and teaching purposes only.** Do **not** use this project for any illegal activity, unauthorized cracking, copyright infringement, or bypassing third-party protections. You must follow local laws and the target app’s terms. You are solely responsible for misuse.
6
+
7
+ Android unpacking + smali analysis **MCP Server**. Use from Cursor / Codex / Claude Code to manage devices, detect packers, unpack (static / BlackDex / Frida), convert dex→smali, and search API strings.
8
+
9
+ Repo: [https://github.com/TimeCyber/DexAndroid](https://github.com/TimeCyber/DexAndroid)
10
+
11
+ ---
12
+
13
+ ## Features
14
+
15
+ | Capability | MCP tool | Notes |
16
+ | --- | --- | --- |
17
+ | Devices | `list_devices` | Connected ADB devices |
18
+ | Packages | `list_packages` | Optional keyword filter |
19
+ | Packer detect | `detect_packer` | 360 / Tencent / Bangcle / ijiami / Alibaba, etc. |
20
+ | Pull APK | `pull_apk` | Installed app (+ splits) |
21
+ | Static unpack | `static_unpack` | Extract `classes*.dex` |
22
+ | No-Root unpack | `blackdex_prepare` / `blackdex_pull` | BlackDex memory dump |
23
+ | Root unpack | `frida_prepare` / `frida_unpack` | frida-server + frida-dexdump |
24
+ | Decompile | `dex_to_smali` | baksmali → smali |
25
+ | Analyze | `smali_list_classes` / `smali_read_class` / `smali_search` | List / read / regex |
26
+ | Entry locate | `find_app_entry` | MAIN/LAUNCHER + smali onCreate (read-only) |
27
+ | Decode / rebuild | `apk_decode` / `apk_repack` | apktool decode + rebuild/sign |
28
+
29
+ ### Unpacking methods
30
+
31
+ | Method | Root? | Use when |
32
+ | --- | --- | --- |
33
+ | Static | No | Unpacked apps or shell/resources only |
34
+ | BlackDex | No | Most protected apps |
35
+ | Frida | **Yes** | Strong packers / fuller dumps |
36
+
37
+ ---
38
+
39
+ ## Requirements
40
+
41
+ - **Windows / macOS / Linux** (docs use Windows examples)
42
+ - **Node.js** ≥ 18
43
+ - **ADB** on PATH, or set `ADB_PATH`
44
+ - **Java 8+** (for baksmali via `dex_to_smali`)
45
+ - Optional: [BlackDex](https://github.com/CodingGay/BlackDex/releases); rooted device + `frida-server`; `pip install frida-tools frida-dexdump`
46
+
47
+ Place baksmali fat jar / frida-server / BlackDex under local `tools/` (large binaries are gitignored).
48
+
49
+ ---
50
+
51
+ ## Install (recommended)
52
+
53
+ No clone needed — run via npx (auto download from npm):
54
+
55
+ ```bash
56
+ npx -y android-decompile-mcp
57
+ ```
58
+
59
+ Or install globally:
60
+
61
+ ```bash
62
+ npm i -g android-decompile-mcp
63
+ android-decompile-mcp
64
+ ```
65
+
66
+ ### Local development build
67
+
68
+ ```bash
69
+ git clone https://github.com/TimeCyber/DexAndroid.git
70
+ cd DexAndroid
71
+ npm install
72
+ npm run build
73
+ npm start
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Cursor MCP setup
79
+
80
+ Add to `.cursor/mcp.json` or global MCP config:
81
+
82
+ ```json
83
+ {
84
+ "mcpServers": {
85
+ "android-decompile-mcp": {
86
+ "command": "npx",
87
+ "args": ["-y", "android-decompile-mcp"],
88
+ "env": {
89
+ "ADB_PATH": "adb",
90
+ "DEX_OUT_DIR": "./unpack-output"
91
+ }
92
+ }
93
+ }
94
+ }
95
+ ```
96
+
97
+ Restart Cursor / reload MCP. Example prompts: list devices & detect packer; static_unpack a local apk, then dex_to_smali and search login APIs.
98
+
99
+ ---
100
+
101
+ ## Environment variables
102
+
103
+ | Variable | Meaning | Default |
104
+ | --- | --- | --- |
105
+ | `ADB_PATH` | adb executable | `adb` |
106
+ | `DEX_OUT_DIR` | Default output dir | `<cwd>/unpack-output` |
107
+ | `BAKSMALI_JAR` | baksmali jar | auto-discover under `tools/` |
108
+
109
+ ---
110
+
111
+ ## Typical workflows
112
+
113
+ ### 1. Static unpack (fastest)
114
+
115
+ 1. `list_devices` or prepare local `apkPath`.
116
+ 2. `detect_packer`.
117
+ 3. `static_unpack` → `classes*.dex`.
118
+ 4. `dex_to_smali` → smali folder.
119
+ 5. `smali_search` / `smali_read_class`.
120
+
121
+ **Note:** Protected apps often yield only the shell via static unpack—use BlackDex / Frida for business code.
122
+
123
+ ### 2. No-Root (BlackDex)
124
+
125
+ 1. `list_devices`.
126
+ 2. `blackdex_prepare` with `blackdexApkPath`.
127
+ 3. Unpack the target app in BlackDex UI.
128
+ 4. `blackdex_pull` with `targetPkg`.
129
+ 5. `dex_to_smali` then `smali_*`.
130
+
131
+ ### 3. Root (Frida)
132
+
133
+ 1. Rooted device (e.g. Magisk), `adb` ready.
134
+ 2. `frida_prepare` to push/start `tools/frida-server`.
135
+ 3. Matching `frida` / `frida-dexdump` locally (prefer 16.x).
136
+ 4. `frida_unpack` with `pkg`, prefer `spawn: true`, `deepSearch: true`.
137
+ 5. `dex_to_smali` on output, then analyze.
138
+
139
+ If Frida 17 attach fails, align tools to 16.x; some devices need temporary `setenforce 0`.
140
+
141
+ ### 4. smali analysis examples
142
+
143
+ ```text
144
+ smali_list_classes smaliDir=.../smali keyword=login
145
+ smali_search smaliDir=.../smali pattern=https?://|/api/|publicClient/
146
+ smali_read_class smaliDir=.../smali className=com.example.api.ApiService
147
+ ```
148
+
149
+ ---
150
+
151
+ ## Layout
152
+
153
+ ```text
154
+ DexAndroid/
155
+ ├── src/ # MCP server (TypeScript)
156
+ │ ├── index.ts
157
+ │ ├── adb.ts
158
+ │ ├── detect.ts
159
+ │ ├── smali.ts
160
+ │ └── unpack/
161
+ ├── dist/
162
+ ├── examples/ # Damai / Huaxi sample smali.zip + docs
163
+ ├── skills/ # Canonical agent skills (edit here, then sync)
164
+ ├── .cursor/skills/ # Cursor copy
165
+ ├── .agents/skills/ # Codex copy
166
+ ├── .claude/skills/ # Claude Code copy
167
+ ├── tools/ # baksmali / frida-server / BlackDex (local)
168
+ ├── unpack-output/ # local dumps (gitignored)
169
+ ├── package.json
170
+ └── README.md
171
+ ```
172
+
173
+ ### Agent skills (Cursor / Codex / Claude Code)
174
+
175
+ After unpacking, use **`android-api-smali-analysis`** so the agent recovers **headers, body, encrypt/decrypt methods, and keys** (smali / `.so` / server-delivered), not path-only notes.
176
+
177
+ | Client | Skill path |
178
+ | --- | --- |
179
+ | Canonical | [`skills/android-api-smali-analysis/SKILL.md`](./skills/android-api-smali-analysis/SKILL.md) |
180
+ | Cursor | [`.cursor/skills/android-api-smali-analysis/`](./.cursor/skills/android-api-smali-analysis/) |
181
+ | Codex | [`.agents/skills/android-api-smali-analysis/`](./.agents/skills/android-api-smali-analysis/) |
182
+ | Claude Code | [`.claude/skills/android-api-smali-analysis/`](./.claude/skills/android-api-smali-analysis/) (`/android-api-smali-analysis`) |
183
+
184
+ Edit the canonical file, then sync copies:
185
+
186
+ ```bash
187
+ node tools/sync-skills.mjs
188
+ ```
189
+
190
+ See [`skills/README.md`](./skills/README.md).
191
+
192
+ ---
193
+
194
+ ## Decompile examples
195
+
196
+ See [`examples/`](./examples/) (smali shipped as zip):
197
+
198
+ | Sample | Path | Contents |
199
+ | --- | --- | --- |
200
+ | Damai | [`examples/damai/`](./examples/damai/) | Frida smali.zip + API docs |
201
+ | Huaxi Maternity | [`examples/huaxi/`](./examples/huaxi/) | Static smali.zip (`info.cd120.two`) |
202
+
203
+ After unzip, run `smali_list_classes` / `smali_search` / `smali_read_class`.
204
+
205
+ ---
206
+
207
+ ## MCP tool cheatsheet
208
+
209
+ | Tool | Params |
210
+ | --- | --- |
211
+ | `detect_packer` | `apkPath` or `pkg`, optional `serial` |
212
+ | `pull_apk` | `pkg`, optional `outDir` / `serial` |
213
+ | `static_unpack` | `apkPath` or `pkg`, optional `outDir` |
214
+ | `blackdex_prepare` | `blackdexApkPath`, optional `serial` |
215
+ | `blackdex_pull` | `targetPkg`, optional `outDir` / `serial` |
216
+ | `frida_prepare` | optional `serial` / `serverLocalPath` |
217
+ | `frida_unpack` | `pkg`, optional `spawn` / `deepSearch` / `outDir` |
218
+ | `dex_to_smali` | `dexInput`, optional `outDir` |
219
+ | `smali_list_classes` | `smaliDir`, optional `keyword` |
220
+ | `smali_read_class` | `smaliDir`, `className` |
221
+ | `smali_search` | `smaliDir`, `pattern`, optional `flags` / `maxResults` |
222
+ | `find_app_entry` | `projectDir` / `manifestPath` / `apkPath`, optional `smaliDir`(只读定位入口) |
223
+ | `apk_decode` | `apkPath`, optional `outDir`(apktool 解码) |
224
+ | `apk_repack` | `projectDir`, optional `outApk` / keystore 参数(重建并签名) |
225
+ | `smali_patch` | `mode` + `smaliPath`/`projectDir`;调用方 `content` 或 `insert_verify_log` |
226
+
227
+ ---
228
+
229
+ ## FAQ
230
+
231
+ **Q: Empty `list_devices`?**
232
+ Check USB debugging, `adb devices`, pass `serial` if multiple.
233
+
234
+ **Q: No business classes after static unpack?**
235
+ Likely packed—use BlackDex or Frida.
236
+
237
+ **Q: `dex_to_smali` failed?**
238
+ Install Java; put baksmali jar in `tools/` or set `BAKSMALI_JAR`.
239
+
240
+ **Q: Frida jailed / version mismatch?**
241
+ Keep `frida-server` and host `frida` major versions aligned; try 16.x.
242
+
243
+ **Q: Where is output?**
244
+ Default `unpack-output/` (or `DEX_OUT_DIR`). **Do not commit dumps.**
245
+
246
+ ---
247
+
248
+ ## Legal & disclaimer
249
+
250
+ This project is **only for learning, teaching, and authorized security research**. It is strictly forbidden to use it for any criminal or illegal activity, including unauthorized access, cracking, piracy, attacking systems, or IP infringement. Authors and contributors are not liable for misuse. By using this software you agree to these terms.
251
+
252
+ > ⚠️ **For learning and teaching purposes only.** Do **not** use this project for any illegal activity, unauthorized cracking, copyright infringement, or bypassing third-party protections. You must follow local laws and the target app’s terms. You are solely responsible for misuse.
253
+
254
+ ---
255
+
256
+ ## License
257
+
258
+ MIT — see [`LICENSE`](./LICENSE).
@@ -0,0 +1,226 @@
1
+ # DexAndroid
2
+
3
+ [English](./README.md) · [简体中文](./README.zh-CN.md) · [繁體中文](./README.zh-TW.md) · [日本語](./README.ja.md) · [한국어](./README.ko.md) · [Español](./README.es.md) · [Français](./README.fr.md) · [Deutsch](./README.de.md) · **Português** · [Русский](./README.ru.md) · [العربية](./README.ar.md) · [हिन्दी](./README.hi.md) · [Bahasa Indonesia](./README.id.md) · [Tiếng Việt](./README.vi.md) · [ไทย](./README.th.md) · [Italiano](./README.it.md) · [Türkçe](./README.tr.md)
4
+
5
+ > ⚠️ **Apenas para aprendizado e ensino.** Não use para atividades ilegais, cracking não autorizado, violação de direitos ou contorno de proteções de terceiros. Cumpra as leis locais e os termos do app. Você é responsável pelo mau uso.
6
+
7
+ **MCP Server** de unpacking Android + análise smali. No Cursor / Claude: dispositivos, detecção de packers, unpack estático / BlackDex / Frida, dex→smali e busca de APIs.
8
+
9
+ Repo: [https://github.com/TimeCyber/DexAndroid](https://github.com/TimeCyber/DexAndroid)
10
+
11
+ ---
12
+
13
+ ## Recursos
14
+
15
+ | Capacidade | Ferramenta MCP | Notas |
16
+ | --- | --- | --- |
17
+ | Devices | `list_devices` | Connected ADB devices |
18
+ | Packages | `list_packages` | Optional keyword filter |
19
+ | Packer detect | `detect_packer` | 360 / Tencent / Bangcle / ijiami / Alibaba, etc. |
20
+ | Pull APK | `pull_apk` | Installed app (+ splits) |
21
+ | Static unpack | `static_unpack` | Extract `classes*.dex` |
22
+ | No-Root unpack | `blackdex_prepare` / `blackdex_pull` | BlackDex memory dump |
23
+ | Root unpack | `frida_prepare` / `frida_unpack` | frida-server + frida-dexdump |
24
+ | Decompile | `dex_to_smali` | baksmali → smali |
25
+ | Analyze | `smali_list_classes` / `smali_read_class` / `smali_search` | List / read / regex |
26
+
27
+ ### Métodos de unpack
28
+
29
+ | Método | Root? | Quando |
30
+ | --- | --- | --- |
31
+ | Static | No | Unpacked apps or shell/resources only |
32
+ | BlackDex | No | Most protected apps |
33
+ | Frida | **Yes** | Strong packers / fuller dumps |
34
+
35
+ ---
36
+
37
+ ## Requisitos
38
+
39
+ - **Windows / macOS / Linux** (docs use Windows examples)
40
+ - **Node.js** ≥ 18
41
+ - **ADB** on PATH, or set `ADB_PATH`
42
+ - **Java 8+** (for baksmali via `dex_to_smali`)
43
+ - Optional: [BlackDex](https://github.com/CodingGay/BlackDex/releases); rooted device + `frida-server`; `pip install frida-tools frida-dexdump`
44
+
45
+ Place baksmali fat jar / frida-server / BlackDex under local `tools/` (large binaries are gitignored).
46
+
47
+ ---
48
+
49
+ ## Instalação e build
50
+
51
+ ```bash
52
+ git clone https://github.com/TimeCyber/DexAndroid.git
53
+ cd DexAndroid
54
+ npm install
55
+ npm run build
56
+ ```
57
+
58
+ Iniciar MCP (stdio):
59
+
60
+ ```bash
61
+ npm start
62
+ # node dist/index.js
63
+ ```
64
+
65
+ Modo dev:
66
+
67
+ ```bash
68
+ npm run dev
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Integração Cursor (MCP)
74
+
75
+ Adicione em `.cursor/mcp.json` (**ajuste os caminhos**):
76
+
77
+ ```json
78
+ {
79
+ "mcpServers": {
80
+ "dex-android-unpack": {
81
+ "command": "node",
82
+ "args": ["E:/DexAndroid/dist/index.js"],
83
+ "env": {
84
+ "ADB_PATH": "E:/Android/Sdk/platform-tools/adb.exe",
85
+ "DEX_OUT_DIR": "E:/DexAndroid/unpack-output"
86
+ }
87
+ }
88
+ }
89
+ }
90
+ ```
91
+
92
+ Reinicie o Cursor / recarregue o MCP.
93
+
94
+ ---
95
+
96
+ ## Variáveis de ambiente
97
+
98
+ | Variável | Significado | Padrão |
99
+ | --- | --- | --- |
100
+ | `ADB_PATH` | adb executable | `adb` |
101
+ | `DEX_OUT_DIR` | Default output dir | `<cwd>/unpack-output` |
102
+ | `BAKSMALI_JAR` | baksmali jar | auto-discover under `tools/` |
103
+
104
+ ---
105
+
106
+ ## Fluxos típicos
107
+
108
+ ### 1. Unpack estático (mais rápido)
109
+
110
+ 1. `list_devices` or prepare local `apkPath`.
111
+ 2. `detect_packer`.
112
+ 3. `static_unpack` → `classes*.dex`.
113
+ 4. `dex_to_smali` → smali folder.
114
+ 5. `smali_search` / `smali_read_class`.
115
+
116
+ **Note:** Protected apps often yield only the shell via static unpack—use BlackDex / Frida for business code.
117
+
118
+ ### 2. Sem Root (BlackDex)
119
+
120
+ 1. `list_devices`.
121
+ 2. `blackdex_prepare` with `blackdexApkPath`.
122
+ 3. Unpack the target app in BlackDex UI.
123
+ 4. `blackdex_pull` with `targetPkg`.
124
+ 5. `dex_to_smali` then `smali_*`.
125
+
126
+ ### 3. Com Root (Frida)
127
+
128
+ 1. Rooted device (e.g. Magisk), `adb` ready.
129
+ 2. `frida_prepare` to push/start `tools/frida-server`.
130
+ 3. Matching `frida` / `frida-dexdump` locally (prefer 16.x).
131
+ 4. `frida_unpack` with `pkg`, prefer `spawn: true`, `deepSearch: true`.
132
+ 5. `dex_to_smali` on output, then analyze.
133
+
134
+ If Frida 17 attach fails, align tools to 16.x; some devices need temporary `setenforce 0`.
135
+
136
+ ### 4. Exemplos smali
137
+
138
+ ```text
139
+ smali_list_classes smaliDir=.../smali keyword=login
140
+ smali_search smaliDir=.../smali pattern=https?://|/api/|publicClient/
141
+ smali_read_class smaliDir=.../smali className=com.example.api.ApiService
142
+ ```
143
+
144
+ ---
145
+
146
+ ## Estrutura
147
+
148
+ ```text
149
+ DexAndroid/
150
+ ├── src/ # MCP server (TypeScript)
151
+ │ ├── index.ts
152
+ │ ├── adb.ts
153
+ │ ├── detect.ts
154
+ │ ├── smali.ts
155
+ │ └── unpack/
156
+ ├── dist/
157
+ ├── examples/ # Damai / Huaxi sample smali.zip + docs
158
+ ├── tools/ # baksmali / frida-server / BlackDex (local)
159
+ ├── unpack-output/ # local dumps (gitignored)
160
+ ├── package.json
161
+ └── README.md
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Exemplos de decompilação
167
+
168
+ Veja [`examples/`](./examples/) (smali em zip):
169
+
170
+ | Exemplo | Caminho | Conteúdo |
171
+ | --- | --- | --- |
172
+ | Damai | [`examples/damai/`](./examples/damai/) | Frida smali.zip + API docs |
173
+ | Huaxi Maternity | [`examples/huaxi/`](./examples/huaxi/) | Static smali.zip (`info.cd120.two`) |
174
+
175
+ Após extrair, use `smali_*`.
176
+
177
+ ---
178
+
179
+ ## Cola rápida MCP
180
+
181
+ | Tool | Params |
182
+ | --- | --- |
183
+ | `detect_packer` | `apkPath` or `pkg`, optional `serial` |
184
+ | `pull_apk` | `pkg`, optional `outDir` / `serial` |
185
+ | `static_unpack` | `apkPath` or `pkg`, optional `outDir` |
186
+ | `blackdex_prepare` | `blackdexApkPath`, optional `serial` |
187
+ | `blackdex_pull` | `targetPkg`, optional `outDir` / `serial` |
188
+ | `frida_prepare` | optional `serial` / `serverLocalPath` |
189
+ | `frida_unpack` | `pkg`, optional `spawn` / `deepSearch` / `outDir` |
190
+ | `dex_to_smali` | `dexInput`, optional `outDir` |
191
+ | `smali_list_classes` | `smaliDir`, optional `keyword` |
192
+ | `smali_read_class` | `smaliDir`, `className` |
193
+ | `smali_search` | `smaliDir`, `pattern`, optional `flags` / `maxResults` |
194
+
195
+ ---
196
+
197
+ ## FAQ
198
+
199
+ **Q: Empty `list_devices`?**
200
+ Check USB debugging, `adb devices`, pass `serial` if multiple.
201
+
202
+ **Q: No business classes after static unpack?**
203
+ Likely packed—use BlackDex or Frida.
204
+
205
+ **Q: `dex_to_smali` failed?**
206
+ Install Java; put baksmali jar in `tools/` or set `BAKSMALI_JAR`.
207
+
208
+ **Q: Frida jailed / version mismatch?**
209
+ Keep `frida-server` and host `frida` major versions aligned; try 16.x.
210
+
211
+ **Q: Where is output?**
212
+ Default `unpack-output/` (or `DEX_OUT_DIR`). **Do not commit dumps.**
213
+
214
+ ---
215
+
216
+ ## Aviso legal
217
+
218
+ Este projeto é **somente para aprendizado, ensino e pesquisa de segurança autorizada**. É proibido usá-lo para crimes ou ilegalidades (acesso não autorizado, cracking, pirataria, ataques ou violação de PI). Autores e contribuidores não respondem por abusos. Ao usar, você concorda com estes termos.
219
+
220
+ > ⚠️ **Apenas para aprendizado e ensino.** Não use para atividades ilegais, cracking não autorizado, violação de direitos ou contorno de proteções de terceiros. Cumpra as leis locais e os termos do app. Você é responsável pelo mau uso.
221
+
222
+ ---
223
+
224
+ ## License
225
+
226
+ MIT — see [`LICENSE`](./LICENSE).