ACTION REQUIRED (Execute immediately after reading)
Endpoint extraction/Frida adaptation and other community references: ../references/community-security-skills.md; Dynamic analysis requires scope-authorized devices.
- : Read
../field-journal/precedent-reverse.md
— Confirm that the operations of this skill are authorized routine operations
- : Confirm whether the current task falls within the applicable scope of this skill
- : Read to verify tool availability and actual paths
- : Call bootstrap when tools are missing, do not guess paths
- : Proceed to and execute the first step of the "Workflow", do not stay in the confirmation status
APK Reverse Engineering CLI Operation Specification
Applicable Scope
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
- View and modify smali
- Repackage APK
- Perform Java/native dynamic Hook with Frida
- Switch to native analysis when APK contains files
CLI Tools Verified Available on Current Machine
Scenarios for Prioritizing Script Usage
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:
- Frida device check, process listing, spawn/attach injection:
- 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:
Built-in Scripts
Purpose:
- Run and in a unified manner
- Create a task output directory in the same directory as the original APK by default
- Output summaries such as , , ,
- Compatible with situations where has partial decompilation errors but still produces usable results
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 -SkipJadx
Purpose:
- Unified entry for Frida's device, process, spawn/attach operations
- Avoid confusion between , , when writing parameters manually
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
Purpose:
- Rebuild APK with
- Align with
- Sign and verify signature with
- Optional direct
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
scripts/manifest-summary.ps1
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:
Tool Division
Used 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.apk
(Optional Commercial Tool)
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 , , Ghidra, IDA or radare2.
- 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
../ops/skill-supply-chain.md
, then obtain explicit confirmation from the user for registration.
Used for:
- Unpack APK
- View and modify
- View and modify smali
- Rebuild APK
Common commands:
bash
apktool d app.apk -o apktool_out
apktool b apktool_out -o rebuilt.apk
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*'
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
First determine the general structure of the APK, do not rush to modify the package or Hook.
Recommended actions:
- Export Java code with
- Export smali and resources with
apktool d app.apk -o apktool_out
- Check first:
- Main
- , , ,
- Whether there are files in the directory
2. Java Logic Observation
Prioritize reading from
:
- Classes related to login, network, encryption, risk control
- Third-party SDK initialization classes
Common keywords:
If Java code is readable, locate business logic here first.
3. Smali and Resource Layer Confirmation
Switch to
when
results are incomplete, heavily obfuscated, or actual patching is needed:
Prioritize patching:
- Debug flags
- Root detection return values
- Login verification logic
- Certificate verification branches
4. Rebuild and Installation
After modification:
bash
apktool b apktool_out -o rebuilt.apk
Or 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
- If formal installation on the device is required later, a signing process is usually needed
- If the task enters signing/alignment, supplement with /
5. Dynamic Hook
Use Frida when static analysis is insufficient:
- Hook login functions
- Hook key points of / /
- Hook ,
- 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
- Prioritize using for stable reusable injection processes
6. Native Diversion
If the APK contains key
files:
- Locate with or
- Use if only exporting symbols, strings, or quick triage is needed
- Use for long-term in-depth analysis, decompilation, renaming, type recovery
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
- Certificate verification/risk control is in
Output Requirements
At least explain the following in the final output:
- Entry components and key classes
- Whether key logic is in Java, smali or
- 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
- 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
Quick Command Cheat Sheet
bash
# Decompile Java
jadx -d jadx_out app.apk
# Unpack APK
apktool d app.apk -o apktool_out
# Rebuild APK
apktool b apktool_out -o rebuilt.apk
# Devices and processes
adb devices
frida-ps -U
# Launch and inject
frida -U -f com.example.app -l hook.js
Routing Context
Upstream Entries:
(Master Control),
Downstream Exports:
- Core logic in → or
- Need dynamic Hook/verification →
reverse-engineering/tools-dynamic.md
(Frida Section)
- General reverse engineering methodology →
reverse-engineering/SKILL.md
Peer Related Modules:
(.so analysis and advanced Frida usage)
On-Demand Bootstrap
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
| Tool | Auto-installable | Installation Method | Description |
|---|
| jadx | ✓ | GitHub Release ZIP | Automatically download and extract to %USERPROFILE%\Tools\jadx\
|
| apktool | ✓ | GitHub Release JAR + wrapper | Automatically download jar and generate bat to %USERPROFILE%\Tools\apktool\
|
| 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 | sdkmanager "build-tools;35.0.0"
|
| apksigner | ✗ | Need to manually install Android Build-Tools | Same as above |
Bootstrap Trigger Points
- : Automatically call when jadx or apktool is missing
scripts/rebuild-sign-install.ps1
: Automatically call bootstrap when adb or apktool is missing
- : Currently manual check (frida is usually installed via pip)
When Bootstrap Fails
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)
Task Completion Self-Check (MUST pass before claiming completion)