agentleFS
xAmirHamza77xAmirHamza77/ReverseOps-Skill/skills/apk-reverse/SKILL.md

apk-reverse

Skill4 starsChanged 4 months agoMITView on GitHub

Use when performing Android APK reverse engineering in a CLI environment. Applies to APK unpacking, Java decompilation, smali modification, repackaging, and Frida dynamic hooking, with on-demand switching to so/native analysis. Prefer locally installed jadx, apktool, frida, adb, ida-reverse, radare2.

  • Installs packages

5 other projects use a version of this, 4 of them edited.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

19 rules. About 0 are common, 9 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Prefer this skill when the task falls into any of the following scenarios:

    line 20
  2. Very specific:

    Run jadx + apktool in one pass and produce a summary: scripts/decode.ps1

    line 42
  3. Very specific:

    Only invoke when tool-index confirms JEB is available locally.

    line 158
  4. Very specific:

    Read from jadx_out first:

    line 230
  5. Distinctive:

    If the Java code is readable, locate business logic here first.

    line 251
  6. Very specific:

    When jadx output is incomplete, heavily obfuscated, or an actual patch is needed, switch to apktool_out:

    line 255
  7. Distinctive:

    If you later need to install officially to a device, a signing process is usually also required

    line 286
  8. Very specific:

    If the task enters signing/alignment, additionally use apksigner / zipalign

    line 287
  9. Distinctive:

    When static analysis is insufficient, use Frida:

    line 291
  10. Very specific:

    Use frida-* directly for simple one-off commands

    line 306
  11. Very specific:

    If the APK contains critical .so files:

    line 311
  12. Very specific:

    Use apktool or jadx to find lib//*.so

    line 313
  13. Distinctive:

    If a patch was made, explain what was changed

    line 331
  14. Very specific:

    If hooking was done, explain which class/method/exported function was hooked

    line 332
  15. Distinctive:

    Do not blindly modify smali right away

    line 336
  16. Distinctive:

    Do not write hooks before reviewing the manifest and main entry point

    line 337
  17. Distinctive:

    Do not equate incomplete Java decompilation directly with "logic unanalyzable"

    line 338
  18. Very specific:

    Do not keep grinding on the Java layer when the .so clearly carries the core logic

    line 339
  19. Distinctive:

    If automatic installation fails, the script throws a clear error with manual installation links.

    line 399

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

ACTION REQUIRED (execute immediately after reading)

Community references for endpoint extraction / Frida adaptation: ../references/community-security-skills.md; dynamic analysis requires a scope-authorized device.

  1. NOW: Read ../field-journal/precedent-reverse.md — confirm that this skill's operations are authorized routine operations
  2. NOW: Confirm whether the current task falls within this skill's scope
  3. NEXT: Read ../tool-index.md, verify tool availability and actual paths
  4. NEXT: When tools are missing, invoke bootstrap; do not guess paths
  5. ACT: Enter the first step of the "Workflow" and execute; do not stop at the confirmation stage

APK Reverse Engineering CLI Operating Guidelines

Scope

Prefer this skill when the task falls into any of the following scenarios:

  • Analyzing an APK's Java business logic
  • Locating login, signing, risk control, certificate validation, root detection
  • Viewing and modifying AndroidManifest.xml
  • Viewing and modifying smali
  • Repackaging an APK
  • Performing Java/native dynamic hooking with Frida
  • Switching to native analysis when the APK contains .so files

CLI tools verified available on the current machine

  • jadx 1.5.5
  • apktool 3.0.2
  • frida-ps 17.9.6
  • adb
  • java

Scenarios where bundled scripts are preferred

The following workflows are high-frequency and have error-prone parameters; prefer the skill's bundled scripts:

  • Run jadx + apktool in one pass and produce a summary: scripts/decode.ps1
  • Frida device checks, process listing, spawn/attach injection: scripts/frida-run.ps1
  • Rebuild, align, sign, and install an APK: scripts/rebuild-sign-install.ps1
  • Quickly extract key Manifest components and permissions: scripts/manifest-summary.ps1

The following one-liners are invoked directly and are not wrapped:

  • adb devices
  • adb logcat
  • frida-ps -U
  • jadx --version
  • apktool --version

Bundled scripts

scripts/decode.ps1

Purpose:

  • Runs jadx and apktool uniformly
  • Creates a task output directory alongside the original APK by default
  • Outputs a summary including package, java_files, smali_dirs, so_files
  • Tolerates partial jadx decompilation errors as long as usable artifacts are produced

Examples:

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

scripts/frida-run.ps1

Purpose:

  • Unifies the Frida device, process, and spawn/attach entry points
  • Avoids confusion between -f, -n, -U when writing arguments by hand

Examples:

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:

  • apktool b to rebuild the APK
  • zipalign alignment
  • apksigner signing and signature verification
  • Optionally run adb install directly

Examples:

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"

Notes:

  • Generates and reuses a debug keystore by default
  • Outputs alongside ProjectDir by default, keeping it together with the original package and unpacking directory

scripts/manifest-summary.ps1

Purpose:

  • Extract the package name
  • List permissions
  • List activity/service/receiver/provider
  • Mark the main launcher activity

Example:

pwsh -File "<skill-root>\apk-reverse\scripts\manifest-summary.ps1" -ManifestPath "C:\work\apktool_out\AndroidManifest.xml"

To analyze .so files, lib/arm64-v8a/*.so, lib/armeabi-v7a/*.so, additionally combine with:

  • ida-reverse
  • radare2

Tool Roles

jadx

Used for:

  • Reading Java decompilation output
  • Searching package names, class names, method names
  • Understanding the APK from high-level logic first

Common commands:

jadx -d jadx_out app.apk
jadx --single-class com.example.LoginActivity -d jadx_out app.apk
jadx --deobf -d jadx_out app.apk

JEB Pro (optional commercial tool)

Used for:

  • Cross-validation and deep decompilation of Android DEX / APK / ARM
  • Supplementing static analysis when JADX output is incomplete or heavily obfuscated
  • Second-toolchain verification of classes, methods, and call relationships for the same target

Boundaries:

  • JEB Pro is commercial software; the user must obtain and install a valid license themselves. This package will not download, crack, or circumvent licensing.
  • Only invoke when tool-index confirms JEB is available locally; otherwise continue using jadx, apktool, Ghidra, IDA, or radare2.
  • Third-party JEB MCP bridges are not a dependency of this package. Before installation, the source code, permissions, network behavior, and version must be reviewed per ../ops/skill-supply-chain.md, then registration must be explicitly confirmed by the user.

apktool

Used for:

  • Unpacking APKs
  • Viewing and modifying AndroidManifest.xml
  • Viewing and modifying smali
  • Rebuilding APKs

Common commands:

apktool d app.apk -o apktool_out
apktool b apktool_out -o rebuilt.apk

frida

Used for:

  • Dynamically observing Java method calls
  • Hooking native exported functions
  • Bypassing root detection, certificate validation, debug detection

Common commands:

frida-ps -U
frida -U -f com.example.app -l hook.js
frida-trace -U -f com.example.app -j '*!*certificate*'

adb

Used for:

  • Device connection
  • Installing APKs
  • Viewing logs
  • Pulling files

Common commands:

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 APK's rough composition; do not rush to patch or hook.

Suggested actions:

  1. Export Java code with jadx -d jadx_out app.apk
  2. Export smali and resources with apktool d app.apk -o apktool_out
  3. Review first:
    • AndroidManifest.xml
    • Main package
    • application, activity, service, receiver
    • Whether lib/ contains .so files

2. Java logic observation

Read from jadx_out first:

  • MainActivity
  • Application
  • Login, networking, encryption, risk-control related classes
  • Third-party SDK initialization classes

Common keywords:

  • login
  • sign
  • encrypt
  • cipher
  • token
  • root
  • certificate
  • trust
  • okhttp
  • retrofit
  • webview

If the Java code is readable, locate business logic here first.

3. Smali and resource layer confirmation

When jadx output is incomplete, heavily obfuscated, or an actual patch is needed, switch to apktool_out:

  • Look at smali*/
  • Look at res/values/strings.xml
  • Look at AndroidManifest.xml

Priority patch targets:

  • android:exported
  • Debug flags
  • Root detection return values
  • Login verification logic
  • Certificate validation branches

4. Rebuild and install

After modification:

apktool b apktool_out -o rebuilt.apk

Or close the loop directly with the script:

pwsh -File "<skill-root>\apk-reverse\scripts\rebuild-sign-install.ps1" -ProjectDir "apktool_out" -Install -Reinstall -DeviceSerial "127.0.0.1:7555"

Notes:

  • This skill only guarantees the apktool rebuild pipeline
  • If you later need to install officially to a device, a signing process is usually also required
  • If the task enters signing/alignment, additionally use apksigner / zipalign

5. Dynamic hooking

When static analysis is insufficient, use Frida:

  • Hook login functions
  • Hook key OkHttp / Retrofit / WebView points
  • Hook javax.crypto, MessageDigest
  • Hook root detection functions
  • Hook SSL pinning logic

Principles:

  • Hook the Java layer first, then assess whether native hooking is needed
  • Print parameters and return values first, then decide whether to actively modify return values

Recommendations:

  • Use frida-* directly for simple one-off commands
  • For stable, reusable injection workflows prefer scripts/frida-run.ps1

6. Native .so routing

If the APK contains critical .so files:

  • Use apktool or jadx to find lib/**/*.so
  • For export symbols, strings, quick triage only, use radare2
  • For long-term deep analysis, decompilation, renaming, type recovery, use ida-reverse

Switch to native promptly when you see these signals:

  • The Java layer is only a JNI wrapper
  • Core signing logic is not in Java
  • Key logic disappears after System.loadLibrary()
  • Certificate validation / risk control lives in a .so

Output requirements

At minimum, the final report must state:

  • Entry components and key classes
  • Whether key logic lives in Java, smali, or .so
  • Confirmed sensitive points: login, signing, root, SSL, WebView, JNI
  • If a patch was made, explain what was changed
  • If hooking was done, explain which class/method/exported function was hooked

Prohibited actions

  • Do not blindly modify smali right away
  • Do not write hooks before reviewing the manifest and main entry point
  • Do not equate incomplete Java decompilation directly with "logic unanalyzable"
  • Do not keep grinding on the Java layer when the .so clearly carries the core logic

Quick command cheatsheet

# 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

# Spawn and inject
frida -U -f com.example.app -l hook.js

Routing context

Upstream entries: skills/SKILL.md (master), routing.md Downstream exits:

  • Core logic in .so → ida-reverse/ or radare2/
  • Dynamic hooking/validation needed → reverse-engineering/tools-dynamic.md (Frida section)
  • General reverse-engineering methodology → reverse-engineering/SKILL.md

Sibling modules: reverse-engineering/ (.so analysis and advanced Frida usage)


On-Demand Bootstrap

This skill's entry scripts are integrated with the unified bootstrap system. Missing tools do not produce an immediate error; instead, an installation attempt is made automatically.

Automation capability boundaries

ToolAuto-installableInstall methodNotes
jadxYesGitHub Release ZIPAuto download and extract to %USERPROFILE%\Tools\jadx\
apktoolYesGitHub Release JAR + wrapperAuto download jar and generate a bat in %USERPROFILE%\Tools\apktool\
JEB ProNoUser installs manually and provides a valid licenseOptional Android / ARM cross-validation tool; third-party MCP bridges require separate audit
frida / frida-psYespip install frida-toolsRequires Python installed
adbYeswinget / fallback pathAuto installs Android Platform-Tools
zipalignNoRequires manual Android Build-Tools installationsdkmanager "build-tools;35.0.0"
apksignerNoRequires manual Android Build-Tools installationSame as above

Bootstrap trigger points

  • scripts/decode.ps1: auto-invokes bootstrap-reverse.ps1 when jadx or apktool is missing
  • scripts/rebuild-sign-install.ps1: auto-invokes bootstrap when adb or apktool is missing
  • scripts/frida-run.ps1: still manual checks for now (frida is usually already installed via pip)

When bootstrap fails

If automatic installation fails, the script throws a clear error with manual installation links. Common causes:

  • Network unreachable (GitHub API / PyPI not reachable)
  • winget unavailable (Windows version too old)
  • Java not installed (apktool depends on a JDK)

Task completion self-check (MUST pass before claiming completion)

  • Did I execute each step of the workflow (rather than only reading)?
  • Did I use real tool paths based on tool-index?
  • Did I produce reproducible evidence (commands/scripts/screenshots/reports)?
  • Did I complete and write back the Checklist items required by RULES?

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.