agentleFS
HSSkyBoyHSSkyBoy/apk-reverse/SKILL.md

apk-reverse

Skill16 starsChanged 56 days agoMITView on GitHub

Unified reverse engineering toolkit covering Android APK decompilation, native .so/ELF binary analysis, and general reverse engineering techniques. Use for APK unpacking, Java/smali modification, Frida hooking, native binary reversing, CTF challenges, and anti-analysis bypass.

15 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use ctf-sandbox, browser-extension-reverse and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • TaiMaBenJiSkill

    ctf-sandbox

    Thin PRIMARY for CTF / AWD / 靶场 multi-type orchestration. Hands off to the sidecar CTF-Sandbox-Orchestrator. Use when the user says CTF, AWD, 靶场, or 比赛题 and no more specific pwn/APK/IDA route already won.

    Also in 4 projects that use this

  • zhaoxuya520Skill

    browser-extension-reverse

    Use for authorized reverse engineering of browser extensions (Chrome/Firefox) including manifest analysis, background workers, and extension-based credential or traffic logic recovery.

    Also in 3 projects that use this

  • zhaoxuya520Skill

    cloud-k8s

    Use for authorized cloud, container, and Kubernetes security assessment including metadata SSRF, IAM misconfig, container escape paths, and cluster RBAC review.

    Also in 3 projects that use this

  • Wang200935Skill

    digital-forensics

    Comprehensive CTF forensics workflows covering file type identification,

    Also in 3 projects that use this

  • Youchu-lawhubSkill

    case-review

    收到裁判文书后的研析与复盘——三级覆盖:庭审复盘(庭后五维效果分析)、裁判文书研析报告(主体/诉请与判决/请求权/事实查明/说理/裁判结果六维 + 逐页比对事实认定与证据采信、提炼胜败因)、结案复盘报告(结案报告十项 + 四维反思)。两种深度:自办案件(调取台账/事实梳理/过程文书做深度复盘)与非自办/受限信息(仅基于用户提供的裁判文书与有限信息),输出面向客户/法务领导/业务部门汇报。触发词:复盘、裁判文书分析、判决分析、研析判决、结案报告、结案复盘、办案总结、庭审复盘、败诉分析。

    Also in 3 projects that use this

  • conjure-3301Skill

    email-security

    DNS-level email authentication (SPF/DKIM/DMARC) exploitation, mail infrastructure attacks, relay abuse, and domain verification gaps — the infrastructure layer beneath email header injection

    Also in 3 projects that use this

  • +6 more from zhaoxuya520

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 0 are common, 7 are distinctive, and 8 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All scripts have PowerShell (.ps1) and Bash (.sh) versions.

    line 74
  2. Very specific:

    All scripts output key=value lines to stdout.

    line 88
  3. Distinctive:

    Do not rush into patching or hooking.

    line 137
  4. Very specific:

    Read from jadx_out first. Key classes to examine:

    line 151
  5. Very specific:

    When jadx output is incomplete or a patch is needed, switch to apktool_out:

    line 178
  6. Distinctive:

    When static analysis is insufficient:

    line 202
  7. Very specific:

    Prefer scripts/frida-run.ps1 for stable injection

    line 211
  8. Very specific:

    If the APK contains important .so files, switch to Part 2 when:

    line 215
  9. Distinctive:

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

    line 411
  10. Distinctive:

    Do not blindly modify smali at the start

    line 448
  11. Distinctive:

    Do not write hooks before checking the Manifest and main entry point

    line 449
  12. Distinctive:

    Do not treat incomplete Java decompilation as proof the logic cannot be analysed

    line 450
  13. Very specific:

    Do not keep forcing Java-layer analysis when .so clearly carries core logic

    line 451
  14. Distinctive:

    Do not jump to full reverse engineering before trying strings and dynamic triage

    line 452
  15. Very specific:

    Do not use angr before understanding the binary's structure

    line 453

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “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

Reverse Engineering Toolkit

Overview

This skill is organised into three major parts. Start with the part that matches your target, then cross-reference as needed.

PartWhen to UseEntry Point
Part 1: APKAndroid APK reversing — Java/smali, AndroidManifest, Frida hooks, rebuildStart here for any .apk
Part 2: SONative .so / ELF / PE / Mach-O binary analysis — GDB, r2, Ghidra, Unicorn, anti-debugSwitch here when core logic lives in native code
Part 3: GeneralCTF patterns, language-specific RE (Python/WASM/.NET), platform RE (macOS/IoT), crypto tools, AI-assisted REReference here for non-APK, non-native RE tasks

Prerequisites

ToolPurposePart
jadxJava decompilationAPK
apktoolAPK decode/rebuildAPK
frida-toolsDynamic instrumentationAPK / SO
adbAndroid device interactionAPK
radare2 / rizinCLI binary analysisSO
gdb / pwndbgDynamic debuggingSO
GhidraDecompilationSO
angrSymbolic executionSO
Unicorn / QilingEmulationSO

Where tools are installed (Windows)

Before downloading or installing anything, run scripts/start.ps1 -CheckOnly — most tools are already installed locally and the scripts know where to look. When a tool is not on PATH, the scripts search these roots in order (see scripts/lib/ToolDiscovery.ps1):

  1. %REVERSE_TOOLS_DIR% (if set)
  2. %USERPROFILE%\Tools
  3. E:\Tools

Inside a root they accept <name>.bat/.cmd/.exe, <name>*.jar, and versioned folders with an optional bin\ (e.g. E:\Tools\jadx-1.5.6\bin\jadx.bat, E:\Tools\apktool.bat + apktool_3.0.2.jar). If you need a tool directly (outside the scripts), call it by these paths.

When a tool is reported missing, do not download or install it yourself — ask the user first: "Have you already installed <tool>? If so, where?" Users often have it in a folder the scripts do not know about (then use that path and extend ToolDiscovery.ps1 / tools.sh and this list). Only offer to download it if the user confirms it is not installed.

The scripts run on Windows PowerShell 5.1 as well as pwsh; when pwsh is missing use powershell -File ....


Part 1: APK Reverse Engineering

Tools

  • jadx — Java decompilation and reading
  • apktool — APK decode, smali inspection, rebuild
  • frida / frida-ps — Dynamic Java method hooking
  • adb — Device connection, install, logcat, file pull
  • NPatch — Non-root Xposed module integration
  • apksigner / zipalign — Signing and alignment (manual install via Android Build-Tools)

Bundled Scripts

All scripts have PowerShell (.ps1) and Bash (.sh) versions. Use .ps1 on Windows, .sh on Linux/macOS.

ScriptPurpose
scripts/decode.ps1 / .shRun jadx + apktool in one pass, write results to disk, generate summary
scripts/frida-run.ps1 / .shDevice check, process listing, spawn/attach injection
scripts/rebuild-sign-install.ps1 / .shRebuild, align, sign, and optionally install APK
scripts/manifest-summary.ps1 / .shExtract key Manifest components and permissions
scripts/start.ps1MCP server management — check tools, bootstrap, report status
scripts/open.ps1MCP file opening — detect type, route to decode pipeline

Script Output Format

All scripts output key=value lines to stdout. Component entries use tab-separated fields (name\texported\tenabled).

decode scripts produce: task_root, jadx_out, apktool_out, package, jadx_exit_code, apktool_exit_code, java_files, smali_dirs, so_files, xml_files, warning (on non-zero exit)

manifest-summary scripts produce: package, permission_count, permission=..., activity_count, activity=name\texported\tenabled, service_count, service=..., receiver_count, receiver=..., provider_count, provider=..., main_activity=...

rebuild-sign-install scripts produce: unsigned_apk, aligned_apk, signed_apk, keystore, install_device (if --install)

start scripts produce: status=ready|degraded|unavailable, plus per-tool <tool>=available|missing lines for jadx, apktool, frida, adb, python, java, zipalign, apksigner, keytool

open scripts produce: type=apk|elf|pe|macho|other, path, mime, size, decode_target=apk|so|none; with --Decode on APK, additionally produces all decode.ps1 output keys

Script Examples

# Windows (PowerShell)
pwsh -File ".\scripts\decode.ps1" -ApkPath "D:\DOWNLOAD\app.apk" -Clean
pwsh -File ".\scripts\frida-run.ps1" -Usb -Spawn -Package com.example.app -ScriptPath "D:\hooks\test.js"
pwsh -File ".\scripts\rebuild-sign-install.ps1" -ProjectDir "C:\work\apktool_out" -Install
pwsh -File ".\scripts\manifest-summary.ps1" -ManifestPath "C:\work\apktool_out\AndroidManifest.xml"
pwsh -File ".\scripts\start.ps1"
pwsh -File ".\scripts\start.ps1" -CheckOnly
pwsh -File ".\scripts\open.ps1" -TargetPath "D:\DOWNLOAD\app.apk" -Decode -Clean
pwsh -File ".\scripts\open.ps1" -TargetPath "D:\DOWNLOAD\app.apk" -DetectOnly
# Linux/macOS (Bash)
bash scripts/decode.sh app.apk --clean
bash scripts/frida-run.sh --usb --spawn --package com.example.app --script hooks/test.js
bash scripts/rebuild-sign-install.sh apktool_out --install
bash scripts/manifest-summary.sh --manifest apktool_out/AndroidManifest.xml

Recommended Workflow

1. Triage

Do not rush into patching or hooking. First determine the APK structure:

jadx -d jadx_out app.apk
apktool d app.apk -o apktool_out

Inspect:

  • AndroidManifest.xml — package, application, activity, service, receiver
  • lib/ — whether .so files are present (if yes, check Part 2)
  • Key permissions (network, root, SSL)

2. Java Logic Observation

Read from jadx_out first. Key classes to examine:

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

Common keywords: login, sign, encrypt, cipher, token, root, certificate, trust, okhttp, retrofit, webview

Finding a client's API endpoints / request parameters (e.g. to reimplement a store's category or ranking calls):

  1. Cheap first pass, no decompile: extract the DEX string table and grep it. Windows has no strings, so use unzip -oq app.apk 'classes*.dex' then grep -aoE '[ -~]{5,}' classes.dex > classes.txt. Method names / URL paths are plain constants (client.getTabDetail, /api/market/...); but the values of constants (e.g. a URI behind RANKING_URI) are usually not adjacent, so this pass only gives names.
  2. Decompile with scripts/decode.ps1 -SkipApktool (jadx only is enough for code) and grep -rn the constant name in jadx_out/sources to get its value and its call sites.
  3. jadx exiting with code 1 and "finished with errors, count: N" on large APKs is normal — individual methods fail to decompile; the exported sources are still usable (the script prints a warning instead of failing).
  4. Confirm a hypothesis by replaying it against the live API (a throwaway test or curl) before writing production code. Obfuscated apps rename classes but keep string constants, so search by string, not by class name.

3. Smali / Resource Confirmation

When jadx output is incomplete or a patch is needed, switch to apktool_out:

  • Inspect smali*/
  • Inspect res/values/strings.xml
  • Inspect AndroidManifest.xml

Patch priorities:

  • android:exported
  • Debug flags
  • Root-detection return values
  • Certificate-validation branches

4. Rebuild & Install

apktool b apktool_out -o rebuilt.apk

Or use the full-loop script:

pwsh -File ".\scripts\rebuild-sign-install.ps1" -ProjectDir "apktool_out" -Install -Reinstall

5. Dynamic Hooking (Frida)

When static analysis is insufficient:

  • Hook login functions
  • Hook OkHttp / Retrofit / WebView
  • Hook javax.crypto and MessageDigest
  • Hook root-detection and SSL pinning

Recommendations:

  • Hook Java first, then evaluate native hooks
  • Print parameters and return values first, then modify if needed
  • Prefer scripts/frida-run.ps1 for stable injection

6. Native .so Routing

If the APK contains important .so files, switch to Part 2 when:

  • The Java layer is only a JNI wrapper
  • Core signing or crypto logic is not in Java
  • Logic disappears after System.loadLibrary()
  • Certificate validation or risk-control logic is inside .so

Reference Files

  • references/apk/android-advanced.md — Native SO/JNI, packers, Flutter/RN
  • references/apk/apk-security-checklist.md — OWASP-aligned test checklist
  • references/apk/frida-bypass-kit.md — FridaBypassKit integration guide
  • references/apk/frida-cookbook.md — Reusable Frida hook scripts by category
  • references/apk/smali-apk-patching.md — Dalvik opcode patching, signature bypass, debug & log injection

Part 2: Native Binary / .SO Analysis

Covers ELF, PE, Mach-O, and any native binary analysis. Use this when you are working with .so files from an APK, standalone ELF binaries, or any compiled native target.

Tools

ToolPurposeCommon Commands
radare2 / rizinCLI disassembly, analysis, patchingr2 ./binary, aaa, afl, pdf @ main
gdb / pwndbg / GEFDynamic debugginggdb ./binary, start, b *main+0xca
GhidraHeadless decompilationanalyzeHeadless project/ tmp -import binary -postScript script.py
UniDbgAndroid ARM32/ARM64 .so emulation & JNI simulationJava API, Dobby hooking, sign algorithm extraction
UnicornCPU emulation for code snippetsPython API, see reference notes
QilingCross-platform emulation with OS supportql.run()
FridaNative function hooking, memory scanningfrida binary, Interceptor.attach()
angrSymbolic execution, CFG recoveryproj = angr.Project('./binary')

Quick Wins (Try First)

# Plaintext extraction
strings binary | grep -iE "flag|secret|password"
rabin2 -z binary | grep -i "flag"

# Dynamic triage — often reveals behaviour without full reversing
ltrace ./binary
strace -f -s 500 ./binary

# Run with test inputs
./binary AAAA
echo "test" | ./binary

Initial Analysis

file binary              # Type, architecture
checksec --file=binary   # Security features
rabin2 -I binary         # Binary info
strings binary           # Extract strings

Analysis Workflow

  1. Strings extraction — many easy targets have readable flags
  2. Dynamic triage — ltrace/strace often reveals behaviour
  3. Frida hooking — hook strcmp/memcmp to capture expected values
  4. Symbolic execution — angr solves many flag-checkers automatically
  5. Emulation (UniDbg / Qiling / Unicorn) — execute and extract crypto/signing routines without physical devices
  6. Map control flow — before modifying execution
  7. Automate — via r2pipe, Frida, angr, Python scripting

Key Topics & Reference Files

TopicFile
ELF structure, headers, sections, dynamic linkingreferences/so/elf-analysis.md
UniDbg ARM32/ARM64 .so emulation, JNI stubbing, Dobby hookingreferences/so/unidbg-emulator.md
GDB, r2, Ghidra, Unicorn, Python bytecode, WASM, .NET, packersreferences/so/tools.md
Frida, angr, lldb, x64dbg, Qiling, Triton, Intel Pinreferences/so/tools-dynamic.md
VMProtect, Themida, BinDiff, deobfuscation, RetDec, LLVM liftingreferences/so/tools-advanced.md
Linux/Windows anti-debug, anti-VM, anti-DBI, integrity checksreferences/so/anti-analysis.md
Go binary reversing (GoReSym, memory layout, goroutines)references/so/go-reverse.md
Kernel driver reversing (WDM, KMDF, minifilter, Linux .ko)references/so/kernel-driver-reverse.md
Compiled languages (Rust, Swift, Kotlin/Native, Haskell, C++)references/so/languages-compiled.md
ARM64/AArch64, RISC-V, MIPS, MBR/bootloaderreferences/so/platforms-hardware.md

Common Encryption Patterns

  • XOR with single byte — try all 256 values
  • XOR with known plaintext (flag{, CTF{)
  • RC4 with hardcoded key
  • Custom permutation + XOR
  • XOR with position index (^ i or ^ (i & 0xff))

For more CTF-specific patterns, see references/general/patterns*.md.

PIE Binary Debugging

gdb ./binary
start                    # Forces PIE base resolution
b *main+0xca            # Relative to main
run

Memory Dumping Strategy

Let the program compute the answer, then dump it. Break at the final comparison (b *main+OFFSET), enter any input of correct length, then x/s $rsi to dump the computed value.


Part 3: General Reverse Engineering

Cross-cutting reference material for CTF challenges, non-native RE targets, and specialised techniques. Part 3 does not duplicate Part 2's tool guides; it adds challenge patterns, language specifics, platform knowledge, and meta-resources.

CTF Challenge Patterns

FileContent
references/general/patterns.mdCustom VMs, XOR ciphers, S-Box, self-modifying code, LLVM obfuscation, anti-debug patterns
references/general/patterns-ctf.mdEmulator opcodes, LD_PRELOAD key extraction, RC4+VM loaders, kernel module mazes
references/general/patterns-ctf-2.mdMulti-layer decrypt, stack string deobfuscation, lattice/circuit patterns, ROP obfuscation
references/general/patterns-ctf-3.mdZ3 circuits, keyboard LED Morse, GLSL shader VM, BPF JIT, DNN inversion

Language-Specific Techniques

FileTarget Languages
references/general/languages.mdPython bytecode, WASM, HarmonyOS HAP/ABC, Brainfuck/esolangs, UEFI, DOS, FRACTRAN
references/general/languages-platforms.mdAndroid JNI obfuscation, Electron, Node.js, Verilog, Ruby/Perl, Rust serde_json, Intel SGX

Platform-Specific Reversing

FilePlatforms
references/general/platforms.mdmacOS/iOS (Mach-O, dyld, Swift), embedded/IoT (firmware, UART, RTOS), automotive CAN bus

Crypto & Encoding Tools

references/general/crypto-decode-tools.md — Ciphey, CyberChef, dcode.fr, Base64/32/16, Caesar, Vigenère, XOR, AES weak keys, Morse, hash identification. Written in Chinese (中文).

AI-Assisted Reverse Engineering

references/general/ai-assisted-re.md — LLM4Decompile, Decaf (compiler-feedback verification), constraint-guided multi-agent decompilation, REMEND equation extraction. Written in Chinese (中文).

Quick Reference

references/general/field-notes.md — Binary type identification (pyc, WASM, APK, Flutter, .NET, UPX, Tauri), anti-debugging bypass, S-Box/keystream patterns, custom VM analysis, signal-based binary exploration, x86-64 gotchas, iterative solver patterns, Unicorn emulation notes.

Resources

references/general/awesome-re-resources.md — Curated lists of RE tools, tutorials, and communities (awesome-reversing, awesome-reverse-engineering, malware-analysis resources, ARM exploitation guides).


Bootstrap

This skill's scripts can optionally install missing tools. When a required tool is not found, the bootstrap script asks before attempting automatic installation.

Automation Boundaries

ToolAuto-installMethodNotes
jadx✓apt / brew / manualWindows: manual download from GitHub
apktool✓apt / brew / manualWindows: manual download from apktool.org
frida-tools✓pipRequires Python
adb✓apt / brew / winget
zipalign✗Manual Android Build-Toolssdkmanager "build-tools;<version>"
apksigner✗Manual Android Build-ToolsSame as above
radare2✓apt / brew / winget
gdb✓apt / brewWindows: manual or WSL
Ghidra✗Manual downloadRequires JDK 17+

Bootstrap Trigger Points

  • scripts/decode.ps1 / .sh — prompts when jadx or apktool is missing
  • scripts/rebuild-sign-install.ps1 / .sh — prompts when adb or apktool is missing
  • scripts/frida-run.ps1 / .sh — prompts when frida is missing
  • scripts/start.ps1 — prompts for all critical tools (jadx, apktool, frida, adb)

When Bootstrap Fails

If automatic installation fails or the user declines, the script throws a clear error with manual installation links. Common reasons: network unavailable, package manager not available, Java or Python not installed.


Re-routing Logic

You encounter…Start hereThen route to…
.apk filePart 1 (APK)Part 2 if .so contains core logic
.so / ELF / PE / Mach-OPart 2 (SO)Part 3 for CTF patterns or anti-debug
APK with .so filesPart 1 (APK) triage, then Part 2 for .so analysisPart 3 for anti-analysis patterns
CTF reversing challengePart 2 (SO) triagePart 3 for patterns / language specifics
Python bytecode, WASM, .NETPart 3 (General) → languages.mdPart 2 if native tools needed
Anti-debug / anti-VM bypassPart 2 (SO) → anti-analysis.md
Symbolic execution / emulationPart 2 (SO) → tools-dynamic.md
Flutter / React Native APKPart 1 (APK) → android-advanced.md

Output Requirements

The final response must at least explain:

  • APK analysis: entry components, key classes, whether key logic is in Java, smali, or .so, sensitive points (login, signing, root, SSL, WebView, JNI), what was patched or hooked
  • Native analysis: binary type, architecture, notable functions/strings, anti-debug techniques encountered, bypass used, what was hooked or patched
  • General analysis: challenge type, relevant patterns, toolchain used, solved approach

Prohibited Practices

  • Do not blindly modify smali at the start
  • Do not write hooks before checking the Manifest and main entry point
  • Do not treat incomplete Java decompilation as proof the logic cannot be analysed
  • Do not keep forcing Java-layer analysis when .so clearly carries core logic
  • Do not jump to full reverse engineering before trying strings and dynamic triage
  • Do not use angr before understanding the binary's structure

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.