jadx by brownfinesecurity/iothackbot
npx skills add https://github.com/brownfinesecurity/iothackbot --skill jadx您正在帮助用户使用 jadx 反编译 Android APK 文件,将 DEX 字节码转换为可读的 Java 源代码,用于安全分析、漏洞发现和理解应用内部结构。
Jadx 是一个将 dex 转换为 Java 的反编译器,能从 Android APK 文件生成清晰、可读的 Java 源代码。与 apktool(生成 smali 代码)不同,jadx 生成的是实际的 Java 代码,更易于阅读和分析。它对于以下方面至关重要:
Jadx 提供两种界面:
CLI (jadx) : 命令行界面
GUI (jadx-gui) : 图形界面
何时使用每种界面:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
标准反编译命令:
jadx <apk-file> -d <output-directory>
示例:
jadx app.apk -d app-decompiled
使用反混淆(推荐用于混淆过的应用):
jadx --deobf app.apk -d app-decompiled
反编译后,输出目录包含:
app-decompiled/
├── sources/ # Java 源代码
│ └── com/company/app/ # 包结构
│ ├── MainActivity.java
│ ├── utils/
│ ├── network/
│ └── ...
└── resources/ # 解码后的资源
├── AndroidManifest.xml # 可读的清单文件
├── res/ # 资源
│ ├── layout/ # XML 布局
│ ├── values/ # 字符串、颜色
│ ├── drawable/ # 图片
│ └── ...
└── assets/ # 应用资源文件
多线程反编译(更快):
jadx -j 4 app.apk -d output
# -j 指定线程数(默认:CPU 核心数)
跳过资源(仅代码,快得多):
jadx --no-res app.apk -d output
跳过源代码(仅资源):
jadx --no-src app.apk -d output
启用反混淆:
jadx --deobf app.apk -d output
反混淆映射输出:
jadx --deobf --deobf-rewrite-cfg --deobf-use-sourcename app.apk -d output
显示不一致/错误的代码:
jadx --show-bad-code app.apk -d output
导出为 Gradle 项目:
jadx --export-gradle app.apk -d output
回退模式(当反编译失败时):
jadx --fallback app.apk -d output
反编译后,搜索常见安全问题:
# 搜索 API 密钥
grep -r "api.*key\|apikey\|API_KEY" app-decompiled/sources/
# 搜索密码和凭据
grep -r "password\|credential\|secret" app-decompiled/sources/
# 搜索硬编码的 URL
grep -rE "https?://[^\"]+" app-decompiled/sources/
# 搜索加密密钥
grep -r "AES\|DES\|RSA\|encryption.*key" app-decompiled/sources/
# 搜索令牌
grep -r "token\|auth.*token\|bearer" app-decompiled/sources/
# 搜索数据库密码
grep -r "jdbc\|database\|db.*password" app-decompiled/sources/
SQL 注入:
grep -r "SELECT.*FROM.*WHERE" app-decompiled/sources/ | grep -v "PreparedStatement"
grep -r "rawQuery\|execSQL" app-decompiled/sources/
不安全的加密:
grep -r "DES\|MD5\|SHA1" app-decompiled/sources/
grep -r "SecureRandom.*setSeed" app-decompiled/sources/
grep -r "Cipher.getInstance" app-decompiled/sources/ | grep -v "AES/GCM"
不安全的存储:
grep -r "SharedPreferences" app-decompiled/sources/
grep -r "MODE_WORLD_READABLE\|MODE_WORLD_WRITABLE" app-decompiled/sources/
grep -r "openFileOutput" app-decompiled/sources/
WebView 漏洞:
grep -r "setJavaScriptEnabled.*true" app-decompiled/sources/
grep -r "addJavascriptInterface" app-decompiled/sources/
grep -r "WebView.*loadUrl" app-decompiled/sources/
证书固定绕过:
grep -r "TrustManager\|HostnameVerifier" app-decompiled/sources/
grep -r "checkServerTrusted" app-decompiled/sources/
查找入口点:
# 主活动
grep -r "extends Activity\|extends AppCompatActivity" app-decompiled/sources/
# Application 类
grep -r "extends Application" app-decompiled/sources/
# 服务
grep -r "extends Service" app-decompiled/sources/
# 广播接收器
grep -r "extends BroadcastReceiver" app-decompiled/sources/
追踪网络通信:
# 查找 HTTP 客户端使用
grep -r "HttpURLConnection\|OkHttpClient\|Retrofit" app-decompiled/sources/
# 查找 API 端点
grep -r "@GET\|@POST\|@PUT\|@DELETE" app-decompiled/sources/
# 查找基础 URL
grep -r "baseUrl\|BASE_URL\|API_URL" app-decompiled/sources/
查找认证逻辑:
grep -r "login\|Login\|authenticate\|Authorization" app-decompiled/sources/
grep -r "jwt\|JWT\|bearer\|Bearer" app-decompiled/sources/
识别出感兴趣的类后,直接读取它们:
# 查看特定类
cat app-decompiled/sources/com/example/app/LoginActivity.java
# 使用 less 进行分页
less app-decompiled/sources/com/example/app/network/ApiClient.java
# 在特定类中搜索
grep "password" app-decompiled/sources/com/example/app/LoginActivity.java
启动 GUI:
jadx-gui app.apk
GUI 功能:
GUI 工作流程:
两种工具互补:
Jadx 优势:
Apktool 优势:
推荐工作流程:
# 使用 jadx 进行代码分析
jadx --deobf app.apk -d app-jadx
# 使用 apktool 获取资源和 smali
apktool d app.apk -o app-apktool
# 分析两个输出
grep -r "API_KEY" app-jadx/sources/
grep -r "api_key" app-apktool/res/
# 1. 使用反混淆进行反编译
jadx --deobf app.apk -d app-decompiled
# 2. 搜索硬编码的秘密
echo "[+] 搜索 API 密钥..."
grep -ri "api.*key\|apikey" app-decompiled/sources/ | tee findings-apikeys.txt
echo "[+] 搜索密码..."
grep -ri "password\|passwd\|pwd" app-decompiled/sources/ | tee findings-passwords.txt
echo "[+] 搜索 URL..."
grep -rE "https?://[^\"]+" app-decompiled/sources/ | tee findings-urls.txt
# 3. 检查加密使用情况
echo "[+] 检查加密实现..."
grep -r "Cipher\|SecretKey\|KeyStore" app-decompiled/sources/ | tee findings-crypto.txt
# 4. 检查不安全的存储
echo "[+] 检查存储机制..."
grep -r "SharedPreferences\|SQLite\|openFileOutput" app-decompiled/sources/ | tee findings-storage.txt
# 5. 总结
echo "[+] 分析完成。检查 findings-*.txt 文件"
对于物联网配套应用,查找设备通信:
# 1. 反编译
jadx --deobf iot-app.apk -d iot-app-decompiled
# 2. 查找设备端点
echo "[+] 查找设备端点..."
grep -rE "https?://[^\"]+" iot-app-decompiled/sources/ | \
grep -v "google\|android\|facebook" | \
tee device-endpoints.txt
# 3. 查找 API 结构
echo "[+] 查找 API 定义..."
grep -r "@GET\|@POST\|@PUT" iot-app-decompiled/sources/ | tee api-endpoints.txt
# 4. 查找认证
echo "[+] 查找认证机制..."
grep -r "Authorization\|authentication\|apiKey" iot-app-decompiled/sources/ | tee auth-methods.txt
# 5. 查找设备发现
echo "[+] 查找设备发现..."
grep -r "discover\|scan\|broadcast\|mdns" iot-app-decompiled/sources/ | tee device-discovery.txt
# 6. 检查证书固定
echo "[+] 检查证书固定..."
grep -r "CertificatePinner\|TrustManager" iot-app-decompiled/sources/ | tee cert-pinning.txt
# 快速反编译(无资源)
jadx --no-res --deobf app.apk -d app-code
# 搜索常见凭据模式
grep -r "username.*password\|user.*pass" app-code/sources/
grep -r "admin\|root\|default.*password" app-code/sources/
grep -r "hardcoded\|TODO.*password\|FIXME.*password" app-code/sources/
# 反编译
jadx app.apk -d app-decompiled
# 查找 Retrofit/REST API 定义
find app-decompiled/sources -name "*Api*.java" -o -name "*Service*.java" -o -name "*Client*.java"
# 提取所有端点
grep -r "@GET\|@POST\|@PUT\|@DELETE\|@PATCH" app-decompiled/sources/ | \
sed 's/.*@\(GET\|POST\|PUT\|DELETE\|PATCH\)("\([^"]*\)".*/\1 \2/' | \
sort -u
# 查找基础 URL
grep -r "baseUrl\|BASE_URL\|API_BASE" app-decompiled/sources/
# 反编译多个 APK
for apk in *.apk; do
name=$(basename "$apk" .apk)
echo "[+] 处理 $apk..."
jadx --no-res --deobf "$apk" -d "decompiled-$name"
# 快速搜索秘密
grep -r "api.*key\|password\|secret" "decompiled-$name/sources/" > "findings-$name.txt"
done
echo "[+] 所有 APK 处理完成。检查 findings-*.txt 文件"
# 大多数生产应用都经过混淆
jadx --deobf app.apk -d output
不使用 --deobf,您会看到类似这样的代码:
public class a {
public void b(String c) { ... }
}
使用 --deobf,jadx 尝试生成有意义的名称:
public class NetworkClient {
public void sendRequest(String url) { ... }
}
# 更快的反编译
jadx -j 8 large-app.apk -d output
# 当只需要代码时,速度快 3-5 倍
jadx --no-res app.apk -d output
创建搜索清单:
对于复杂的应用:
静态分析 (jadx) + 动态分析:
解决方案 : 使用回退模式或显示错误代码:
jadx --fallback --show-bad-code app.apk -d output
解决方案 : 启用反混淆:
jadx --deobf app.apk -d output
解决方案 : 增加 Java 堆大小:
export JAVA_OPTS="-Xmx4096m"
jadx app.apk -d output
或使用内置选项:
jadx -Xmx4096m app.apk -d output
解决方案 : 跳过资源或使用更多线程:
jadx --no-res -j 8 app.apk -d output
解决方案 : 使用 --show-bad-code 查看部分反编译结果:
jadx --show-bad-code app.apk -d output
解决方案 : 首先使用 CLI 检查错误:
jadx app.apk -d test-output
# 如果成功,再尝试 GUI
jadx --export-gradle app.apk -d app-project
cd app-project
./gradlew build
创建一个可构建的 Android Studio 项目。
jadx --deobf --deobf-use-sourcename app.apk -d output
# 检查 output/mapping.txt 获取名称映射
# 所有选项组合
jadx \
--deobf \
--deobf-use-sourcename \
--show-bad-code \
--no-imports \
--no-inline-anonymous \
--no-replace-consts \
app.apk -d output
Jadx 适用于 IoTHackBot 工作流程:
APK → API 发现 :
APK → 凭据提取 :
APK → 协议分析 :
APK → 设备枚举 :
# 基本反编译
jadx <apk> -d <output-dir>
# 使用反混淆(推荐)
jadx --deobf <apk> -d <output-dir>
# 快速(无资源)
jadx --no-res <apk> -d <output-dir>
# 多线程
jadx -j <threads> <apk> -d <output-dir>
# 显示有问题的代码
jadx --show-bad-code <apk> -d <output-dir>
# 导出为 Gradle 项目
jadx --export-gradle <apk> -d <output-dir>
# GUI 模式
jadx-gui <apk>
# 回退模式
jadx --fallback <apk> -d <output-dir>
使用此清单分析 APK 时:
重要 : 仅反编译您拥有或获得分析权限的 APK。
成功的 jadx 分析包括:
每周安装次数
71
仓库
GitHub 星标
680
首次出现
2026 年 1 月 26 日
安全审计
安装于
opencode62
gemini-cli61
github-copilot58
codex58
cursor58
claude-code50
You are helping the user decompile Android APK files using jadx to convert DEX bytecode into readable Java source code for security analysis, vulnerability discovery, and understanding app internals.
Jadx is a dex to Java decompiler that produces clean, readable Java source code from Android APK files. Unlike apktool (which produces smali), jadx generates actual Java code that's much easier to read and analyze. It's essential for:
Jadx provides two interfaces:
CLI (jadx) : Command-line interface
GUI (jadx-gui) : Graphical interface
When to use each:
Standard decompile command:
jadx <apk-file> -d <output-directory>
Example:
jadx app.apk -d app-decompiled
With deobfuscation (recommended for obfuscated apps):
jadx --deobf app.apk -d app-decompiled
After decompilation, the output directory contains:
app-decompiled/
├── sources/ # Java source code
│ └── com/company/app/ # Package structure
│ ├── MainActivity.java
│ ├── utils/
│ ├── network/
│ └── ...
└── resources/ # Decoded resources
├── AndroidManifest.xml # Readable manifest
├── res/ # Resources
│ ├── layout/ # XML layouts
│ ├── values/ # Strings, colors
│ ├── drawable/ # Images
│ └── ...
└── assets/ # App assets
Multi-threaded decompilation (faster):
jadx -j 4 app.apk -d output
# -j specifies number of threads (default: CPU cores)
Skip resources (code only, much faster):
jadx --no-res app.apk -d output
Skip source code (resources only):
jadx --no-src app.apk -d output
Enable deobfuscation:
jadx --deobf app.apk -d output
Deobfuscation map output:
jadx --deobf --deobf-rewrite-cfg --deobf-use-sourcename app.apk -d output
Show inconsistent/bad code:
jadx --show-bad-code app.apk -d output
Export as Gradle project:
jadx --export-gradle app.apk -d output
Fallback mode (when decompilation fails):
jadx --fallback app.apk -d output
After decompilation, search for common security issues:
# Search for API keys
grep -r "api.*key\|apikey\|API_KEY" app-decompiled/sources/
# Search for passwords and credentials
grep -r "password\|credential\|secret" app-decompiled/sources/
# Search for hardcoded URLs
grep -rE "https?://[^\"]+" app-decompiled/sources/
# Search for encryption keys
grep -r "AES\|DES\|RSA\|encryption.*key" app-decompiled/sources/
# Search for tokens
grep -r "token\|auth.*token\|bearer" app-decompiled/sources/
# Search for database passwords
grep -r "jdbc\|database\|db.*password" app-decompiled/sources/
SQL Injection:
grep -r "SELECT.*FROM.*WHERE" app-decompiled/sources/ | grep -v "PreparedStatement"
grep -r "rawQuery\|execSQL" app-decompiled/sources/
Insecure Crypto:
grep -r "DES\|MD5\|SHA1" app-decompiled/sources/
grep -r "SecureRandom.*setSeed" app-decompiled/sources/
grep -r "Cipher.getInstance" app-decompiled/sources/ | grep -v "AES/GCM"
Insecure Storage:
grep -r "SharedPreferences" app-decompiled/sources/
grep -r "MODE_WORLD_READABLE\|MODE_WORLD_WRITABLE" app-decompiled/sources/
grep -r "openFileOutput" app-decompiled/sources/
WebView vulnerabilities:
grep -r "setJavaScriptEnabled.*true" app-decompiled/sources/
grep -r "addJavascriptInterface" app-decompiled/sources/
grep -r "WebView.*loadUrl" app-decompiled/sources/
Certificate pinning bypass:
grep -r "TrustManager\|HostnameVerifier" app-decompiled/sources/
grep -r "checkServerTrusted" app-decompiled/sources/
Find entry points:
# Main activities
grep -r "extends Activity\|extends AppCompatActivity" app-decompiled/sources/
# Application class
grep -r "extends Application" app-decompiled/sources/
# Services
grep -r "extends Service" app-decompiled/sources/
# Broadcast receivers
grep -r "extends BroadcastReceiver" app-decompiled/sources/
Trace network communication:
# Find HTTP client usage
grep -r "HttpURLConnection\|OkHttpClient\|Retrofit" app-decompiled/sources/
# Find API endpoints
grep -r "@GET\|@POST\|@PUT\|@DELETE" app-decompiled/sources/
# Find base URLs
grep -r "baseUrl\|BASE_URL\|API_URL" app-decompiled/sources/
Find authentication logic:
grep -r "login\|Login\|authenticate\|Authorization" app-decompiled/sources/
grep -r "jwt\|JWT\|bearer\|Bearer" app-decompiled/sources/
After identifying interesting classes, read them directly:
# View specific class
cat app-decompiled/sources/com/example/app/LoginActivity.java
# Use less for pagination
less app-decompiled/sources/com/example/app/network/ApiClient.java
# Search within specific class
grep "password" app-decompiled/sources/com/example/app/LoginActivity.java
Launch GUI:
jadx-gui app.apk
GUI features:
GUI workflow:
Both tools complement each other:
Jadx strengths:
Apktool strengths:
Recommended workflow:
# Use jadx for code analysis
jadx --deobf app.apk -d app-jadx
# Use apktool for resources and smali
apktool d app.apk -o app-apktool
# Analyze both outputs
grep -r "API_KEY" app-jadx/sources/
grep -r "api_key" app-apktool/res/
# 1. Decompile with deobfuscation
jadx --deobf app.apk -d app-decompiled
# 2. Search for hardcoded secrets
echo "[+] Searching for API keys..."
grep -ri "api.*key\|apikey" app-decompiled/sources/ | tee findings-apikeys.txt
echo "[+] Searching for passwords..."
grep -ri "password\|passwd\|pwd" app-decompiled/sources/ | tee findings-passwords.txt
echo "[+] Searching for URLs..."
grep -rE "https?://[^\"]+" app-decompiled/sources/ | tee findings-urls.txt
# 3. Check crypto usage
echo "[+] Checking crypto implementations..."
grep -r "Cipher\|SecretKey\|KeyStore" app-decompiled/sources/ | tee findings-crypto.txt
# 4. Check for insecure storage
echo "[+] Checking storage mechanisms..."
grep -r "SharedPreferences\|SQLite\|openFileOutput" app-decompiled/sources/ | tee findings-storage.txt
# 5. Summary
echo "[+] Analysis complete. Check findings-*.txt files"
For IoT companion apps, find device communication:
# 1. Decompile
jadx --deobf iot-app.apk -d iot-app-decompiled
# 2. Find device communication
echo "[+] Finding device endpoints..."
grep -rE "https?://[^\"]+" iot-app-decompiled/sources/ | \
grep -v "google\|android\|facebook" | \
tee device-endpoints.txt
# 3. Find API structure
echo "[+] Finding API definitions..."
grep -r "@GET\|@POST\|@PUT" iot-app-decompiled/sources/ | tee api-endpoints.txt
# 4. Find authentication
echo "[+] Finding auth mechanisms..."
grep -r "Authorization\|authentication\|apiKey" iot-app-decompiled/sources/ | tee auth-methods.txt
# 5. Find device discovery
echo "[+] Finding device discovery..."
grep -r "discover\|scan\|broadcast\|mdns" iot-app-decompiled/sources/ | tee device-discovery.txt
# 6. Check for certificate pinning
echo "[+] Checking certificate pinning..."
grep -r "CertificatePinner\|TrustManager" iot-app-decompiled/sources/ | tee cert-pinning.txt
# Fast decompilation without resources
jadx --no-res --deobf app.apk -d app-code
# Search for common credential patterns
grep -r "username.*password\|user.*pass" app-code/sources/
grep -r "admin\|root\|default.*password" app-code/sources/
grep -r "hardcoded\|TODO.*password\|FIXME.*password" app-code/sources/
# Decompile
jadx app.apk -d app-decompiled
# Find Retrofit/REST API definitions
find app-decompiled/sources -name "*Api*.java" -o -name "*Service*.java" -o -name "*Client*.java"
# Extract all endpoints
grep -r "@GET\|@POST\|@PUT\|@DELETE\|@PATCH" app-decompiled/sources/ | \
sed 's/.*@\(GET\|POST\|PUT\|DELETE\|PATCH\)("\([^"]*\)".*/\1 \2/' | \
sort -u
# Find base URLs
grep -r "baseUrl\|BASE_URL\|API_BASE" app-decompiled/sources/
# Decompile multiple APKs
for apk in *.apk; do
name=$(basename "$apk" .apk)
echo "[+] Processing $apk..."
jadx --no-res --deobf "$apk" -d "decompiled-$name"
# Quick search for secrets
grep -r "api.*key\|password\|secret" "decompiled-$name/sources/" > "findings-$name.txt"
done
echo "[+] All APKs processed. Check findings-*.txt files"
# Most production apps are obfuscated
jadx --deobf app.apk -d output
Without --deobf, you'll see code like:
public class a {
public void b(String c) { ... }
}
With --deobf, jadx attempts meaningful names:
public class NetworkClient {
public void sendRequest(String url) { ... }
}
# Faster decompilation
jadx -j 8 large-app.apk -d output
# 3-5x faster when you only need code
jadx --no-res app.apk -d output
Create a search checklist:
For complex apps:
Static analysis (jadx) + dynamic analysis:
Solution : Use fallback mode or show bad code:
jadx --fallback --show-bad-code app.apk -d output
Solution : Enable deobfuscation:
jadx --deobf app.apk -d output
Solution : Increase Java heap size:
export JAVA_OPTS="-Xmx4096m"
jadx app.apk -d output
Or use the built-in option:
jadx -Xmx4096m app.apk -d output
Solution : Skip resources or use more threads:
jadx --no-res -j 8 app.apk -d output
Solution : Use --show-bad-code to see partial decompilation:
jadx --show-bad-code app.apk -d output
Solution : Use CLI first to check for errors:
jadx app.apk -d test-output
# If successful, try GUI again
jadx --export-gradle app.apk -d app-project
cd app-project
./gradlew build
Creates a buildable Android Studio project.
jadx --deobf --deobf-use-sourcename app.apk -d output
# Check output/mapping.txt for name mappings
# All options combined
jadx \
--deobf \
--deobf-use-sourcename \
--show-bad-code \
--no-imports \
--no-inline-anonymous \
--no-replace-consts \
app.apk -d output
Jadx fits into the IoTHackBot workflow:
APK → API Discovery :
APK → Credential Extraction :
APK → Protocol Analysis :
APK → Device Enumeration :
# Basic decompilation
jadx <apk> -d <output-dir>
# With deobfuscation (recommended)
jadx --deobf <apk> -d <output-dir>
# Fast (no resources)
jadx --no-res <apk> -d <output-dir>
# Multi-threaded
jadx -j <threads> <apk> -d <output-dir>
# Show problematic code
jadx --show-bad-code <apk> -d <output-dir>
# Export as Gradle project
jadx --export-gradle <apk> -d <output-dir>
# GUI mode
jadx-gui <apk>
# Fallback mode
jadx --fallback <apk> -d <output-dir>
Use this checklist when analyzing APKs with jadx:
IMPORTANT : Only decompile APKs you own or have permission to analyze.
A successful jadx analysis includes:
Weekly Installs
71
Repository
GitHub Stars
680
First Seen
Jan 26, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode62
gemini-cli61
github-copilot58
codex58
cursor58
claude-code50
Azure PostgreSQL 无密码身份验证配置指南:Entra ID 迁移与访问管理
34,800 周安装