Dex2jar 安卓逆向与 DEX/JAR 分析
面向 APK、DEX、ODEX、JAR 与 smali 的综合安卓逆向分析 Skill,围绕 dex2jar 工具链完成 DEX/APK 转 JAR、smali 反汇编与重组、APK 重签名、类与方法结构分析、字符串提取、调用图与依赖关系分析、Manifest 权限与导出组件检查、签名证书识别以及 native/JNI 库排查。适合从未知 APK 初步研判一路深入到代码阅读、敏感行为定位和补丁重构,并附带转换准确性校验与失败回退思路。
在 AI 中使用此 Skill将本页链接复制给 AI,即可让 AI 获取完整 Skill 内容并按此执行
安全提示: 本站 Skill 均经 ChatGPT 最新模型扫描,未发现恶意脚本及危险指令、未检出已知恶意行为特征,但不保证绝对安全,使用即表示接受此风险
Skill 文件
版本 20260601 · 1a1ab76b762603fcce7434f102bd9d35
references/
runtime/
d2j-base-cmd/
src/
main/
java/
com/
googlecode/
dex2jar/
tools/
d2j-jasmin/
src/
main/
antlr3/
com/
googlecode/
d2j/
jasmin/
java/
com/
googlecode/
d2j/
jasmin/
d2j-smali/
src/
main/
antlr4/
com/
googlecode/
d2j/
smali/
antlr4/
java/
com/
googlecode/
d2j/
smali/
dex-ir/
src/
main/
java/
com/
googlecode/
dex2jar/
ir/
expr/
stmt/
ts/
an/
array/
dex-reader-api/
src/
main/
java/
com/
googlecode/
d2j/
node/
analysis/
insn/
reader/
visitors/
dex-reader/
src/
main/
java/
com/
googlecode/
d2j/
reader/
zip/
util/
zip/
dex-tools/
src/
main/
bin_gen/
java/
com/
googlecode/
d2j/
signapk/
tools/
jar/
util/
dex2jar/
bin_gen/
tools/
to/
resources/
com/
googlecode/
dex2jar/
tools/
dex-translator/
libs/
src/
main/
java/
com/
googlecode/
d2j/
asm/
converter/
dex/
util/
org/
objectweb/
asm/
res/
dex-writer/
src/
main/
java/
com/
googlecode/
d2j/
dex/
writer/
ann/
ev/
insn/
io/
item/
dex2jar-ai-cli/
src/
main/
java/
com/
googlecode/
d2j/
ai/
gradle/
wrapper/
SKILL.md
---
name: dex2jar
description: "Android reverse-engineering workbench built on dex2jar. Use whenever the user works with an APK, DEX, ODEX, JAR, smali, or any Android binary — converting DEX/APK to JAR, disassembling to smali, decompiling, signing/resigning APKs, or analyzing app structure, strings, call graphs, dependencies, manifests, signing certificates, or native .so/JNI code. Triggers include: reverse engineer this APK, what does this app do, convert dex to jar, decompile, dex2jar, baksmali, smali, is this apk malicious, what permissions does it request, find the crypto/network/reflection calls, who calls this method, read the signing cert, what native libraries does it ship, JNI entry points, 逆向, 反编译, 把apk转成jar, 看看这个安卓应用做了什么, 这个apk有没有问题. Use proactively for any Android app analysis or triage even if dex2jar is not named explicitly."
license: Apache-2.0
---
# dex2jar — Android Reverse-Engineering Workbench
A workflow skill for analyzing Android applications with the dex2jar toolchain. It
turns "I have an APK/DEX and need to understand it" into a concrete, repeatable
sequence backed by a 29-command CLI that emits structured JSON.
## The backend: `d2j-ai.py`
Every capability is exposed through the packaged `runtime/d2j-ai.py` backend. Always invoke it
through Python and pass `--pretty` when you (the model) need to read the result:
```bash
python3 runtime/d2j-ai.py <command> <file> [options] --pretty
```
It returns JSON with `success`, `error_code`, and command-specific fields, so you
can branch on the result without scraping text. Run `python3 runtime/d2j-ai.py list` to see
all commands, or `python3 runtime/d2j-ai.py info <command>` for a command's options. The
full command catalog (grouped by purpose) is in
[`references/command-reference.md`](references/command-reference.md) — read it when
you need a command you don't already know.
## How to approach a task
Pick the entry point by what the user actually has and wants:
1. **An unknown or suspicious APK, "what is this / is it safe / what's the attack
surface?"** → start with triage. See
[`references/workflow-triage.md`](references/workflow-triage.md). In short:
`manifest-inspect -e` (exported attack surface) → `apk-cert` (who signed it) →
`native-libs -s` (native entry points) → `dex-strings -u` (indicators). This is
also packaged as the focused `apk-triage` skill.
2. **"Convert this to readable Java / decompile it."** → `dex2jar` produces a JAR
you can open in any Java decompiler. Conversion is *bytecode translation, not
decompilation*, and it can legitimately fail on obfuscated or hand-crafted DEX —
read [`references/dex-to-jar-accuracy.md`](references/dex-to-jar-accuracy.md)
before promising a clean result, and verify with `asm-verify`.
3. **"Find where X happens / find the crypto/network/dynamic-loading calls / who
calls this method?"** → reverse cross-reference. `dex-xref --preset crypto`
(also `reflection`, `dynload`, `net`) or `dex-xref --to <substring>`, then
`dex-method-trace --target <method>` to walk callers. Use the same packaged `dex-xref` and `dex-method-trace` workflow to trace sensitive behavior.
4. **Structure-level questions ("what classes/methods are in here?", "what does
this class depend on?")** → `dex-inspect`, `dex-class-deps`, `dex-method-trace`.
5. **Patching / rebuilding (baksmali → edit → smali → sign).** → `baksmali` to
disassemble, edit smali, `smali` to reassemble, `apk-sign` to resign with a test
cert. `dex-weaver`/`jar-weaver` replace invokes in place.
When a request spans several of these, do triage first — it's cheap and tells you
where to dig.
## Packaged backend
This standalone package uses `runtime/d2j-ai.py` as its canonical backend. Before first use, build the bundled Java/core runtime with:
```bash
bash runtime/gradlew -p runtime :dex2jar-ai-cli:build distZip
```
After that, run all workflows through `python3 runtime/d2j-ai.py ... --pretty`.
## Operating notes
- **Input safety:** the CLI validates file type and existence and returns an
`error_code` (`file_not_found`, `invalid_format`, …) rather than throwing — check
it before continuing a workflow.
- **Build requirement:** the structured-analysis commands (`dex-inspect`,
`dex-xref`, `manifest-inspect`, `apk-cert`, `native-libs`, …) run through the
`dex2jar-ai-cli` Java module. If it isn't built, the CLI says so; the bundled runtime must be built first with the command above (Java 8+). The self-contained parsers
(AXML, ELF, PKCS#7) need no external tools — no aapt, NDK, or binutils.
- **Self-contained parsing:** manifest, native-lib, and certificate inspection are
implemented in-tree, so they work offline and on truncated/odd files.
## Scope
This is authorized reverse-engineering / security-analysis tooling (CTF,
pentesting, malware triage, app-security review). It reads and transforms Android
binaries the user already possesses; it does not exfiltrate data or attack remote
systems.
此文件不提供内嵌文本预览
请使用左侧文件行末尾的外链图标打开原始文件。
