apk-reverse
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseACTION REQUIRED(读完后立刻执行)
ACTION REQUIRED (Execute immediately after reading)
端点提取/Frida 自适应等社区对照:../references/community-security-skills.md;动态分析须 scope 授权设备。
- : 读取
NOW— 确认本 skill 的操作是已授权的常规操作../field-journal/precedent-reverse.md - : 确认当前任务是否命中本 skill 的适用范围
NOW - : 读取
NEXT,校验工具可用性和实际路径../tool-index.md - : 缺工具时调用 bootstrap,不要猜路径
NEXT - : 进入"工作流"第一步并执行,不要停在确认状态
ACT
Endpoint extraction/Frida adaptation and other community references: ../references/community-security-skills.md; Dynamic analysis requires scope-authorized devices.
- : Read
NOW— Confirm that the operations of this skill are authorized routine operations../field-journal/precedent-reverse.md - : Confirm whether the current task falls within the applicable scope of this skill
NOW - : Read
NEXTto verify tool availability and actual paths../tool-index.md - : Call bootstrap when tools are missing, do not guess paths
NEXT - : Proceed to and execute the first step of the "Workflow", do not stay in the confirmation status
ACT
APK 逆向 CLI 作业规范
APK Reverse Engineering CLI Operation Specification
适用范围
Applicable Scope
当任务属于以下场景时优先使用本 skill:
- 分析 APK 的 Java 业务逻辑
- 定位登录、签名、风控、证书校验、root 检测
- 查看与修改
AndroidManifest.xml - 查看与修改 smali
- 重打包 APK
- 用 Frida 做 Java/native 动态 Hook
- APK 内含 时切到 native 分析
.so
Prioritize using this skill when the task belongs to the following scenarios:
- Analyze Java business logic of APK
- Locate login, signature, risk control, certificate verification, root detection
- View and modify
AndroidManifest.xml - View and modify smali
- Repackage APK
- Perform Java/native dynamic Hook with Frida
- Switch to native analysis when APK contains files
.so
当前机器已验证可用的 CLI 工具
CLI Tools Verified Available on Current Machine
jadx1.5.5apktool3.0.2frida-ps17.9.6adbjava
jadx1.5.5apktool3.0.2frida-ps17.9.6adbjava
优先使用脚本的场景
Scenarios for Prioritizing Script Usage
以下流程高频且参数容易出错,优先用 skill 自带脚本:
- 一次性完成 落盘并产出摘要:
jadx + apktoolscripts/decode.ps1 - Frida 设备检查、进程列举、spawn/attach 注入:
scripts/frida-run.ps1 - 重建、对齐、签名、安装 APK:
scripts/rebuild-sign-install.ps1 - 快速抽取 Manifest 关键组件与权限:
scripts/manifest-summary.ps1
以下一行命令保持直接调用,不单独封装:
adb devicesadb logcatfrida-ps -Ujadx --versionapktool --version
The following processes are high-frequency and prone to parameter errors, so prioritize using the scripts built into this skill:
- Complete disk output and generate summary in one go:
jadx + apktoolscripts/decode.ps1 - Frida device check, process listing, spawn/attach injection:
scripts/frida-run.ps1 - Rebuild, align, sign, and install APK:
scripts/rebuild-sign-install.ps1 - Quickly extract key components and permissions from Manifest:
scripts/manifest-summary.ps1
Use the following one-line commands directly without separate encapsulation:
adb devicesadb logcatfrida-ps -Ujadx --versionapktool --version
自带脚本
Built-in Scripts
scripts/decode.ps1
scripts/decode.ps1scripts/decode.ps1
scripts/decode.ps1用途:
- 统一跑 和
jadxapktool - 默认在原 APK 同目录创建任务输出目录
- 输出 、
package、java_files、smali_dirs等摘要so_files - 兼容 部分反编译错误但仍然有可用产物的情况
jadx
示例:
powershell
pwsh -File "<skill-root>\apk-reverse\scripts\decode.ps1" -ApkPath "D:\DOWNLOAD\app.apk" -Clean
pwsh -File "<skill-root>\apk-reverse\scripts\decode.ps1" -ApkPath "D:\DOWNLOAD\app.apk" -Name demo -SkipJadxPurpose:
- Run and
jadxin a unified mannerapktool - Create a task output directory in the same directory as the original APK by default
- Output summaries such as ,
package,java_files,smali_dirsso_files - Compatible with situations where has partial decompilation errors but still produces usable results
jadx
Example:
powershell
pwsh -File "<skill-root>\apk-reverse\scripts\decode.ps1" -ApkPath "D:\DOWNLOAD\app.apk" -Clean
pwsh -File "<skill-root>\apk-reverse\scripts\decode.ps1" -ApkPath "D:\DOWNLOAD\app.apk" -Name demo -SkipJadxscripts/frida-run.ps1
scripts/frida-run.ps1scripts/frida-run.ps1
scripts/frida-run.ps1用途:
- 统一 Frida 的设备、进程、spawn/attach 入口
- 避免手写参数时混淆 、
-f、-n-U
示例:
powershell
pwsh -File "<skill-root>\apk-reverse\scripts\frida-run.ps1" -ListDevices
pwsh -File "<skill-root>\apk-reverse\scripts\frida-run.ps1" -Usb -ListProcesses
pwsh -File "<skill-root>\apk-reverse\scripts\frida-run.ps1" -Usb -Spawn -Package com.example.app -ScriptPath "D:\hooks\test.js"Purpose:
- Unified entry for Frida's device, process, spawn/attach operations
- Avoid confusion between ,
-f,-nwhen writing parameters manually-U
Example:
powershell
pwsh -File "<skill-root>\apk-reverse\scripts\frida-run.ps1" -ListDevices
pwsh -File "<skill-root>\apk-reverse\scripts\frida-run.ps1" -Usb -ListProcesses
pwsh -File "<skill-root>\apk-reverse\scripts\frida-run.ps1" -Usb -Spawn -Package com.example.app -ScriptPath "D:\hooks\test.js"scripts/rebuild-sign-install.ps1
scripts/rebuild-sign-install.ps1scripts/rebuild-sign-install.ps1
scripts/rebuild-sign-install.ps1用途:
- 重建 APK
apktool b - 对齐
zipalign - 签名与验签
apksigner - 可选直接
adb install
示例:
powershell
pwsh -File "<skill-root>\apk-reverse\scripts\rebuild-sign-install.ps1" -ProjectDir "C:\work\apktool_out" -Clean
pwsh -File "<skill-root>\apk-reverse\scripts\rebuild-sign-install.ps1" -ProjectDir "C:\work\apktool_out" -Install -Reinstall -DeviceSerial "127.0.0.1:7555"说明:
- 默认生成并复用调试 keystore
- 默认输出到 同目录,便于和原始包、解包目录放在一起
ProjectDir
Purpose:
- Rebuild APK with
apktool b - Align with
zipalign - Sign and verify signature with
apksigner - Optional direct
adb install
Example:
powershell
pwsh -File "<skill-root>\apk-reverse\scripts\rebuild-sign-install.ps1" -ProjectDir "C:\work\apktool_out" -Clean
pwsh -File "<skill-root>\apk-reverse\scripts\rebuild-sign-install.ps1" -ProjectDir "C:\work\apktool_out" -Install -Reinstall -DeviceSerial "127.0.0.1:7555"Description:
- Generate and reuse debug keystore by default
- Output to the same directory as by default, making it easy to place with the original package and unpacked directory
ProjectDir
scripts/manifest-summary.ps1
scripts/manifest-summary.ps1scripts/manifest-summary.ps1
scripts/manifest-summary.ps1用途:
- 抽取包名
- 列权限
- 列 activity/service/receiver/provider
- 标出主启动 activity
示例:
powershell
pwsh -File "<skill-root>\apk-reverse\scripts\manifest-summary.ps1" -ManifestPath "C:\work\apktool_out\AndroidManifest.xml"如果要分析 、、,再结合:
.solib/arm64-v8a/*.solib/armeabi-v7a/*.soida-reverseradare2
Purpose:
- Extract package name
- List permissions
- List activity/service/receiver/provider
- Mark the main launch activity
Example:
powershell
pwsh -File "<skill-root>\apk-reverse\scripts\manifest-summary.ps1" -ManifestPath "C:\work\apktool_out\AndroidManifest.xml"If analyzing , , , combine with:
.solib/arm64-v8a/*.solib/armeabi-v7a/*.soida-reverseradare2
工具分工
Tool Division
jadx
jadxjadx
jadx用于:
- Java 反编译阅读
- 包名、类名、方法名搜索
- 先从高层逻辑理解 APK
常用命令:
bash
jadx -d jadx_out app.apk
jadx --single-class com.example.LoginActivity -d jadx_out app.apk
jadx --deobf -d jadx_out app.apkUsed for:
- Java decompilation and reading
- Package name, class name, method name search
- Understand APK from high-level logic first
Common commands:
bash
jadx -d jadx_out app.apk
jadx --single-class com.example.LoginActivity -d jadx_out app.apk
jadx --deobf -d jadx_out app.apkJEB Pro
(可选商业工具)
JEB ProJEB Pro
(Optional Commercial Tool)
JEB Pro用于:
- Android DEX / APK / ARM 的交叉验证与深度反编译
- 在 JADX 输出不完整或混淆较重时补充静态分析
- 对同一目标的类、方法与调用关系进行第二工具链校验
边界:
- JEB Pro 是商业软件,必须由用户自行取得并安装有效许可证;本包不会下载、破解或规避许可。
- 仅在 已确认本机 JEB 可用时调用;否则继续使用
tool-index、jadx、Ghidra、IDA 或 radare2。apktool - 第三方 JEB MCP bridge 不是本包依赖。安装前必须按 审阅源码、权限、网络行为和版本,再由用户明确确认注册。
../ops/skill-supply-chain.md
Used for:
- Cross-validation and deep decompilation of Android DEX / APK / ARM
- Supplement static analysis when JADX output is incomplete or heavily obfuscated
- Perform second toolchain verification on classes, methods and call relationships of the same target
Boundaries:
- JEB Pro is commercial software, users must obtain and install a valid license on their own; this package will not download, crack or bypass licenses.
- Only call when the local JEB is confirmed available in ; otherwise, continue using
tool-index,jadx, Ghidra, IDA or radare2.apktool - Third-party JEB MCP bridge is not a dependency of this package. Before installation, review the source code, permissions, network behavior and version according to , then obtain explicit confirmation from the user for registration.
../ops/skill-supply-chain.md
apktool
apktoolapktool
apktool用于:
- 解包 APK
- 查看和修改
AndroidManifest.xml - 查看和修改 smali
- 重建 APK
常用命令:
bash
apktool d app.apk -o apktool_out
apktool b apktool_out -o rebuilt.apkUsed for:
- Unpack APK
- View and modify
AndroidManifest.xml - View and modify smali
- Rebuild APK
Common commands:
bash
apktool d app.apk -o apktool_out
apktool b apktool_out -o rebuilt.apkfrida
fridafrida
frida用于:
- 动态观察 Java 方法调用
- Hook native 导出函数
- 绕过 root 检测、证书校验、调试检测
常用命令:
bash
frida-ps -U
frida -U -f com.example.app -l hook.js
frida-trace -U -f com.example.app -j '*!*certificate*'Used for:
- Dynamically observe Java method calls
- Hook native exported functions
- Bypass root detection, certificate verification, debugging detection
Common commands:
bash
frida-ps -U
frida -U -f com.example.app -l hook.js
frida-trace -U -f com.example.app -j '*!*certificate*'adb
adbadb
adb用于:
- 设备连接
- 安装 APK
- 查看日志
- 拉取文件
常用命令:
bash
adb devices
adb install -r app.apk
adb shell pm list packages
adb logcat
adb pull /data/local/tmp/file .Used for:
- Device connection
- APK installation
- View logs
- Pull files
Common commands:
bash
adb devices
adb install -r app.apk
adb shell pm list packages
adb logcat
adb pull /data/local/tmp/file .推荐工作流
Recommended Workflow
1. Triage
1. Triage
先确定 APK 大致构成,不急着改包或 Hook。
建议动作:
- 用 导出 Java 代码
jadx -d jadx_out app.apk - 用 导出 smali 和资源
apktool d app.apk -o apktool_out - 先看:
AndroidManifest.xml- 主
package - 、
application、activity、servicereceiver - 目录里是否有
lib/.so
First determine the general structure of the APK, do not rush to modify the package or Hook.
Recommended actions:
- Export Java code with
jadx -d jadx_out app.apk - Export smali and resources with
apktool d app.apk -o apktool_out - Check first:
AndroidManifest.xml- Main
package - ,
application,activity,servicereceiver - Whether there are files in the
.sodirectorylib/
2. Java 逻辑观察
2. Java Logic Observation
优先从 读:
jadx_outMainActivityApplication- 登录、网络、加密、风控相关类
- 第三方 SDK 初始化类
常见关键词:
loginsignencryptciphertokenrootcertificatetrustokhttpretrofitwebview
如果 Java 代码可读,先在这里定位业务逻辑。
Prioritize reading from :
jadx_outMainActivityApplication- Classes related to login, network, encryption, risk control
- Third-party SDK initialization classes
Common keywords:
loginsignencryptciphertokenrootcertificatetrustokhttpretrofitwebview
If Java code is readable, locate business logic here first.
3. Smali 与资源层确认
3. Smali and Resource Layer Confirmation
当 结果不完整、混淆重、或需要实际 patch 时,切到 :
jadxapktool_out- 看
smali*/ - 看
res/values/strings.xml - 看
AndroidManifest.xml
优先 patch:
android:exported- 调试标记
- root 检测返回值
- 登录验证逻辑
- 证书校验分支
Switch to when results are incomplete, heavily obfuscated, or actual patching is needed:
apktool_outjadx- Check
smali*/ - Check
res/values/strings.xml - Check
AndroidManifest.xml
Prioritize patching:
android:exported- Debug flags
- Root detection return values
- Login verification logic
- Certificate verification branches
4. 重建与安装
4. Rebuild and Installation
修改后:
bash
apktool b apktool_out -o rebuilt.apk或者直接用脚本闭环:
powershell
pwsh -File "<skill-root>\apk-reverse\scripts\rebuild-sign-install.ps1" -ProjectDir "apktool_out" -Install -Reinstall -DeviceSerial "127.0.0.1:7555"说明:
- 本 skill 只保证 重建链路
apktool - 若后续需要正式安装到设备,通常还需要签名流程
- 如果任务进入签名/对齐,补充 /
apksignerzipalign
After modification:
bash
apktool b apktool_out -o rebuilt.apkOr use the script for closed-loop operation directly:
powershell
pwsh -File "<skill-root>\apk-reverse\scripts\rebuild-sign-install.ps1" -ProjectDir "apktool_out" -Install -Reinstall -DeviceSerial "127.0.0.1:7555"Description:
- This skill only guarantees the rebuild link
apktool - If formal installation on the device is required later, a signing process is usually needed
- If the task enters signing/alignment, supplement with /
apksignerzipalign
5. 动态 Hook
5. Dynamic Hook
静态分析不足时,用 Frida:
- Hook 登录函数
- Hook /
OkHttp/Retrofit关键点WebView - Hook 、
javax.cryptoMessageDigest - Hook root 检测函数
- Hook SSL pinning 逻辑
原则:
- 先 Hook Java 层,再看是否需要 native Hook
- 先打印参数与返回值,再决定是否主动修改返回值
建议:
- 简单一次性命令直接用
frida-* - 需要稳定复用的注入流程优先走
scripts/frida-run.ps1
Use Frida when static analysis is insufficient:
- Hook login functions
- Hook key points of /
OkHttp/RetrofitWebView - Hook ,
javax.cryptoMessageDigest - Hook root detection functions
- Hook SSL pinning logic
Principles:
- Hook Java layer first, then decide if native Hook is needed
- Print parameters and return values first, then decide whether to actively modify return values
Recommendations:
- Use directly for simple one-time commands
frida-* - Prioritize using for stable reusable injection processes
scripts/frida-run.ps1
6. Native .so
分流
.so6. Native .so
Diversion
.so如果 APK 中包含关键 :
.so- 用 或
apktool找到jadxlib/**/*.so - 若只是导出符号、字符串、快速 triage,可用
radare2 - 若要长期深入分析、反编译、改名、类型恢复,用
ida-reverse
遇到这些信号要尽快切 native:
- Java 层只是 JNI 包装
- 核心签名逻辑不在 Java
- 后关键逻辑消失
System.loadLibrary() - 证书校验/风控在 中
.so
If the APK contains key files:
.so- Locate with
lib/**/*.soorapktooljadx - Use if only exporting symbols, strings, or quick triage is needed
radare2 - Use for long-term in-depth analysis, decompilation, renaming, type recovery
ida-reverse
Switch to native analysis as soon as encountering these signals:
- Java layer is only JNI wrapper
- Core signature logic is not in Java
- Key logic disappears after
System.loadLibrary() - Certificate verification/risk control is in
.so
输出要求
Output Requirements
最终至少说明:
- 入口组件与关键类
- 关键逻辑在 Java、smali 还是
.so - 已确认的敏感点:登录、签名、root、SSL、WebView、JNI
- 如果做了 patch,说明改了什么
- 如果做了 Hook,说明 Hook 了哪个类/方法/导出函数
At least explain the following in the final output:
- Entry components and key classes
- Whether key logic is in Java, smali or
.so - Confirmed sensitive points: login, signature, root, SSL, WebView, JNI
- If patching is done, explain what was modified
- If Hook is done, explain which class/method/exported function was hooked
禁止事项
Prohibited Items
- 不要一开始就盲目改 smali
- 不要在没看 manifest 和主入口前就写 Hook
- 不要把 Java 反编译不完整直接等同于“逻辑不可分析”
- 不要在 明显承载核心逻辑时继续死磕 Java 层
.so
- Do not blindly modify smali at the beginning
- Do not write Hook before checking manifest and main entry
- Do not directly equate incomplete Java decompilation with "unanalyzable logic"
- Do not continue to focus on Java layer when obviously carries core logic
.so
快速命令备忘
Quick Command Cheat Sheet
bash
undefinedbash
undefined反编译 Java
Decompile Java
jadx -d jadx_out app.apk
jadx -d jadx_out app.apk
解包 APK
Unpack APK
apktool d app.apk -o apktool_out
apktool d app.apk -o apktool_out
重建 APK
Rebuild APK
apktool b apktool_out -o rebuilt.apk
apktool b apktool_out -o rebuilt.apk
设备与进程
Devices and processes
adb devices
frida-ps -U
adb devices
frida-ps -U
启动并注入
Launch and inject
frida -U -f com.example.app -l hook.js
---frida -U -f com.example.app -l hook.js
---路由上下文
Routing Context
上游入口: (总控)、
下游出口:
skills/SKILL.mdrouting.md- 核心逻辑在 →
.so或ida-reverse/radare2/ - 需动态 Hook/验证 → (Frida 章节)
reverse-engineering/tools-dynamic.md - 通用逆向方法论 →
reverse-engineering/SKILL.md
同级关联模块: (.so 分析和 Frida 进阶用法)
reverse-engineering/Upstream Entries: (Master Control),
Downstream Exports:
skills/SKILL.mdrouting.md- Core logic in →
.soorida-reverse/radare2/ - Need dynamic Hook/verification → (Frida Section)
reverse-engineering/tools-dynamic.md - General reverse engineering methodology →
reverse-engineering/SKILL.md
Peer Related Modules: (.so analysis and advanced Frida usage)
reverse-engineering/按需自举(On-Demand Bootstrap)
On-Demand Bootstrap
本 skill 的入口脚本已接入统一自举系统。缺少工具时不会直接报错,而是自动尝试安装。
The entry script of this skill has been integrated into the unified bootstrap system. When tools are missing, it will not report errors directly, but automatically attempt to install them.
自动化能力边界
Automation Capability Boundaries
| 工具 | 可自动安装 | 安装方式 | 说明 |
|---|---|---|---|
| jadx | ✓ | GitHub Release ZIP | 自动下载解压到 |
| apktool | ✓ | GitHub Release JAR + wrapper | 自动下载 jar 并生成 bat 到 |
| JEB Pro | ✗ | 用户手动安装并提供有效许可证 | 可选的 Android / ARM 交叉验证工具;第三方 MCP bridge 需单独审计 |
| frida / frida-ps | ✓ | pip install frida-tools | 需要 Python 已安装 |
| adb | ✓ | winget / fallback path | 自动安装 Android Platform-Tools |
| zipalign | ✗ | 需手动安装 Android Build-Tools | |
| apksigner | ✗ | 需手动安装 Android Build-Tools | 同上 |
| Tool | Auto-installable | Installation Method | Description |
|---|---|---|---|
| jadx | ✓ | GitHub Release ZIP | Automatically download and extract to |
| apktool | ✓ | GitHub Release JAR + wrapper | Automatically download jar and generate bat to |
| JEB Pro | ✗ | User manually installs and provides valid license | Optional Android / ARM cross-validation tool; third-party MCP bridge requires separate audit |
| frida / frida-ps | ✓ | pip install frida-tools | Requires Python to be installed |
| adb | ✓ | winget / fallback path | Automatically install Android Platform-Tools |
| zipalign | ✗ | Need to manually install Android Build-Tools | |
| apksigner | ✗ | Need to manually install Android Build-Tools | Same as above |
自举触发点
Bootstrap Trigger Points
- :缺 jadx 或 apktool 时自动调用
scripts/decode.ps1bootstrap-reverse.ps1 - :缺 adb 或 apktool 时自动调用 bootstrap
scripts/rebuild-sign-install.ps1 - :当前仍为手动检查(frida 通常已通过 pip 安装)
scripts/frida-run.ps1
- : Automatically call
scripts/decode.ps1when jadx or apktool is missingbootstrap-reverse.ps1 - : Automatically call bootstrap when adb or apktool is missing
scripts/rebuild-sign-install.ps1 - : Currently manual check (frida is usually installed via pip)
scripts/frida-run.ps1
自举失败时
When Bootstrap Fails
如果自动安装失败,脚本会抛出明确错误并附带手动安装链接。常见原因:
- 网络不通(GitHub API / PyPI 不可达)
- winget 不可用(Windows 版本过低)
- Java 未安装(apktool 依赖 JDK)
If automatic installation fails, the script will throw a clear error with a manual installation link. Common reasons:
- Network issues (GitHub API / PyPI unreachable)
- winget unavailable (Windows version too low)
- Java not installed (apktool depends on JDK)
任务完成自检(声称完成前 MUST 通过)
Task Completion Self-Check (MUST pass before claiming completion)
- 我是否执行了工作流中的每一步(而不是只阅读)?
- 我是否基于 使用了真实工具路径?
tool-index - 我是否产出了可复现证据(命令/脚本/截图/报告)?
- 我是否完成并回写了 RULES 要求的 Checklist 项?
- Have I executed every step in the workflow (instead of just reading)?
- Have I used real tool paths based on ?
tool-index - Have I produced reproducible evidence (commands/scripts/screenshots/reports)?
- Have I completed and written back the Checklist items required by RULES?