chore(agents): 添加 Android 逆向工程 skill

包含 APK 反编译、API 调用提取、调用链分析、Kotlin 名称恢复等参考文档,
以及 jadx/fernflower 相关脚本与第三方域名过滤列表。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
voidandClaude Sonnet 4.6 committed 2026-11-08 21:15:24 +08:00
1 parent 252b7088cf
commit c29e425996
19 files changed
+4392

No files matched your search

@@ -0,0 +1,221 @@
# Setup Guide: Dependencies for Android Reverse Engineering
## Java JDK 17+
jadx requires Java 17 or later.
### Ubuntu / Debian
```bash
sudo apt update
sudo apt install openjdk-17-jdk
```
### Fedora
```bash
sudo dnf install java-17-openjdk-devel
```
### Arch Linux
```bash
sudo pacman -S jdk17-openjdk
```
### macOS (Homebrew)
```bash
brew install openjdk@17
```
After installation on macOS, follow the symlink instructions printed by Homebrew, or add to your shell profile:
```bash
export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"
```
### Verify
```bash
java -version
# Should show version 17.x or higher
```
---
## jadx
jadx is the Java decompiler used to convert APK/JAR/AAR files to readable Java source.
### Option 1: GitHub Releases (recommended)
1. Go to <https://github.com/skylot/jadx/releases/latest>
2. Download the `jadx-<version>.zip` file (not the source archive)
3. Extract and add to PATH:
```bash
unzip jadx-*.zip -d ~/jadx
export PATH="$HOME/jadx/bin:$PATH"
# Add the export line to your ~/.bashrc or ~/.zshrc for persistence
```
### Option 2: Homebrew (macOS / Linux)
```bash
brew install jadx
```
### Option 3: Build from source
```bash
git clone https://github.com/skylot/jadx.git
cd jadx
./gradlew dist
# Binaries will be in build/jadx/bin/
export PATH="$(pwd)/build/jadx/bin:$PATH"
```
### Verify
```bash
jadx --version
```
---
## Fernflower / Vineflower (optional, recommended)
Fernflower is the JetBrains Java decompiler. It produces better output than jadx on complex Java constructs, lambdas, and generics. [Vineflower](https://github.com/Vineflower/vineflower) is the actively maintained community fork with published releases — prefer it over upstream Fernflower.
### Option 1: Vineflower from GitHub Releases (recommended)
1. Go to <https://github.com/Vineflower/vineflower/releases/latest>
2. Download `vineflower-<version>.jar`
3. Place it and set the environment variable:
```bash
mkdir -p ~/vineflower
mv vineflower-*.jar ~/vineflower/vineflower.jar
export FERNFLOWER_JAR_PATH="$HOME/vineflower/vineflower.jar"
# Add the export to ~/.bashrc or ~/.zshrc for persistence
```
### Option 2: Build Fernflower from source
```bash
git clone https://github.com/JetBrains/fernflower.git
cd fernflower
./gradlew jar
# Produces: build/libs/fernflower.jar
export FERNFLOWER_JAR_PATH="$(pwd)/build/libs/fernflower.jar"
```
### Option 3: Homebrew (Vineflower)
```bash
brew install vineflower
```
### Verify
```bash
java -jar "$FERNFLOWER_JAR_PATH" --version
```
> **Note**: Fernflower only works on JVM bytecode (JAR, class files). For APK/DEX files, you also need **dex2jar** (see below) as an intermediate conversion step.
---
## dex2jar (optional, needed for Fernflower on APK files)
Converts Android DEX bytecode to standard Java JAR files.
### GitHub Releases
1. Go to <https://github.com/ThexXTURBOXx/dex2jar/releases/latest>
2. Download and extract:
```bash
unzip dex-tools-*.zip -d ~/dex2jar
export PATH="$HOME/dex2jar:$PATH"
```
### Homebrew
```bash
brew install dex2jar
```
### Verify
```bash
d2j-dex2jar --help
```
### Usage
```bash
# Convert APK (or DEX) to JAR
d2j-dex2jar -f -o output.jar app.apk
# Then decompile with Fernflower
java -jar vineflower.jar output.jar decompiled/
```
---
## Optional Tools
### apktool
Useful for decoding resources (XML layouts, drawables) that jadx sometimes handles poorly.
```bash
# Ubuntu/Debian
sudo apt install apktool
# macOS
brew install apktool
# Manual: https://apktool.org/docs/install
```
### adb (Android Debug Bridge)
Useful for pulling APKs directly from a connected Android device.
```bash
# Ubuntu/Debian
sudo apt install adb
# macOS
brew install android-platform-tools
```
Pull an APK from a device:
```bash
# List installed packages
adb shell pm list packages | grep <keyword>
# Get APK path
adb shell pm path com.example.app
# Pull the APK
adb pull /data/app/com.example.app-xxxx/base.apk ./app.apk
```
---
## Troubleshooting
| Problem | Solution |
|---|---|
| `jadx: command not found` | Ensure the jadx `bin/` directory is in your `$PATH` |
| `Error: Could not find or load main class` | Java is missing or wrong version — verify with `java -version` |
| jadx runs out of memory on large APKs | Increase heap: `jadx -Xmx4g -d output app.apk` or set `JAVA_OPTS="-Xmx4g"` |
| Decompiled code has many `// Error` comments | Try `--show-bad-code` to see partial output, or use `--deobf` for obfuscated apps |
| Fernflower hangs on a method | Use `-mpm=60` to set a 60-second timeout per method |
| Fernflower JAR not found | Set `FERNFLOWER_JAR_PATH` env variable to the full path of the JAR |
| dex2jar fails with `ZipException` | The APK may have a non-standard ZIP structure — try `jadx` instead |