A toolkit for unpacking and analyzing Android APK files during security research.

Install

mkdir -p .claude/skills/apktool && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/3897" && unzip -o skill.zip -d .claude/skills/apktool && rm skill.zip

Installs to .claude/skills/apktool

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Android APK unpacking and resource extraction tool for reverse engineering. Use when you need to decode APK files, extract resources, examine AndroidManifest.xml, analyze smali code, or repackage modified APKs.
210 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Decompile Android APK into readable smali code
  • Extract XML layouts and resource strings
  • Analyze AndroidManifest.xml permissions
  • Reconstruct APKs after modifications
  • Identify app structure and component hierarchy

How it works

Utilizes a java-based command line interface to disassemble DEX byte-code and decode binary resource formats.

Inputs & outputs

You give it
Path to.apk file
You get back
Unpacked directory with smali, resources, and manifest

When to use apktool

  • Reverse engineer Android apps
  • Extract app resources
  • Analyze security permissions
  • Examine smali code

About this skill

Apktool - Android APK Unpacking and Resource Extraction

You are helping the user reverse engineer Android APK files using apktool for security analysis, vulnerability discovery, and understanding app internals.

Tool Overview

Apktool is a tool for reverse engineering Android APK files. It can decode resources to nearly original form and rebuild them after modifications. It's essential for:

  • Extracting readable AndroidManifest.xml
  • Decoding resources (XML layouts, strings, images)
  • Disassembling DEX to smali code
  • Analyzing app structure and permissions
  • Repackaging modified APKs

Prerequisites

  • apktool must be installed on the system
  • Java Runtime Environment (JRE) required
  • Sufficient disk space (unpacked APK is typically 2-5x original size)
  • Write permissions in output directory

Instructions

1. Basic APK Unpacking (Most Common)

When the user asks to unpack, decode, or analyze an APK:

Standard decode command:

apktool d <apk-file> -o <output-directory>

Example:

apktool d app.apk -o app-unpacked

With force overwrite (if directory exists):

apktool d app.apk -o app-unpacked -f

2. Understanding Output Structure

After unpacking, the output directory contains:

app-unpacked/
├── AndroidManifest.xml          # Readable manifest (permissions, components)
├── apktool.yml                  # Apktool metadata (version info, SDK levels)
├── original/                    # Original META-INF certificates
│   └── META-INF/
├── res/                         # Decoded resources
│   ├── layout/                  # XML layouts
│   ├── values/                  # Strings, colors, dimensions
│   ├── drawable/                # Images and drawables
│   └── ...
├── smali/                       # Disassembled DEX code (smali format)
│   └── com/company/app/        # Package structure
├── assets/                      # App assets (if present)
├── lib/                         # Native libraries (if present)
│   ├── arm64-v8a/
│   ├── armeabi-v7a/
│   └── ...
└── unknown/                     # Files apktool couldn't classify

3. Selective Decoding (Performance Optimization)

Skip resources (code analysis only):

apktool d app.apk -o app-code-only -r
# or
apktool d app.apk -o app-code-only --no-res
  • Faster processing
  • Only extracts smali code and manifest
  • Use when you only need to analyze code logic

Skip source code (resource analysis only):

apktool d app.apk -o app-resources-only -s
# or
apktool d app.apk -o app-resources-only --no-src
  • Faster processing
  • Only extracts resources and manifest
  • Use when you only need resources, strings, layouts

4. Common Analysis Tasks

A. Examining AndroidManifest.xml

The manifest reveals critical security information:

# After unpacking
cat app-unpacked/AndroidManifest.xml

Look for:

  • Permissions: What device features/data the app accesses
  • Exported components: Activities, services, receivers accessible from other apps
  • Intent filters: How the app responds to system/app intents
  • Backup settings: android:allowBackup="true" (security risk)
  • Debuggable flag: android:debuggable="true" (major security issue)
  • Network security config: Custom certificate pinning, cleartext traffic
  • Min/Target SDK versions: Outdated versions may have vulnerabilities

Example analysis commands:

# Find all permissions
grep "uses-permission" app-unpacked/AndroidManifest.xml

# Find exported components
grep "exported=\"true\"" app-unpacked/AndroidManifest.xml

# Check if debuggable
grep "debuggable" app-unpacked/AndroidManifest.xml

# Find all activities
grep "android:name.*Activity" app-unpacked/AndroidManifest.xml

B. Extracting Strings and Resources

# View all string resources
cat app-unpacked/res/values/strings.xml

# Search for API keys, URLs, credentials
grep -r "api" app-unpacked/res/values/
grep -r "http" app-unpacked/res/values/
grep -r "password\|secret\|key\|token" app-unpacked/res/values/

# Find hardcoded URLs in resources
grep -rE "https?://" app-unpacked/res/

C. Analyzing Smali Code

Smali is the disassembled Dalvik bytecode format:

# Find specific class
find app-unpacked/smali -name "*Login*.smali"
find app-unpacked/smali -name "*Auth*.smali"

# Search for security-relevant code
grep -r "crypto\|encrypt\|decrypt" app-unpacked/smali/
grep -r "http\|https\|url" app-unpacked/smali/
grep -r "password\|credential\|token" app-unpacked/smali/

# Find native library usage
grep -r "System.loadLibrary" app-unpacked/smali/

# Find file operations
grep -r "openFileOutput\|openFileInput" app-unpacked/smali/

Note: Smali is harder to read than Java source. Consider using jadx for Java decompilation for easier analysis.

D. Examining Native Libraries

# List native libraries
ls -lah app-unpacked/lib/

# Check architectures supported
ls app-unpacked/lib/

# Identify library types
file app-unpacked/lib/arm64-v8a/*.so

# Search for interesting strings in libraries
strings app-unpacked/lib/arm64-v8a/libnative.so | grep -i "http\|key\|password"

5. Repackaging APK (Build)

After modifying resources or smali code:

apktool b app-unpacked -o app-modified.apk

Important: Rebuilt APKs must be signed before installation:

# Generate keystore (one-time setup)
keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-key-alias

# Sign APK
jarsigner -verbose -keystore my-release-key.jks app-modified.apk my-key-alias

# Verify signature
jarsigner -verify app-modified.apk

# Zipalign (optimization)
zipalign -v 4 app-modified.apk app-modified-aligned.apk

6. Framework Management

For system apps or apps dependent on device manufacturer frameworks:

# Install framework
apktool if framework-res.apk

# List installed frameworks
apktool list-frameworks

# Decode with specific framework
apktool d -t <tag> app.apk

Common Workflows

Workflow 1: Security Analysis

# 1. Unpack APK
apktool d target.apk -o target-unpacked

# 2. Examine manifest for security issues
cat target-unpacked/AndroidManifest.xml

# 3. Search for hardcoded credentials
grep -r "password\|api_key\|secret\|token" target-unpacked/res/

# 4. Check for debuggable flag
grep "debuggable" target-unpacked/AndroidManifest.xml

# 5. Find exported components
grep "exported=\"true\"" target-unpacked/AndroidManifest.xml

# 6. Examine network security config
cat target-unpacked/res/xml/network_security_config.xml 2>/dev/null

Workflow 2: IoT App Analysis

For IoT companion apps, find device communication details:

# 1. Unpack APK
apktool d iot-app.apk -o iot-app-unpacked

# 2. Search for device endpoints
grep -rE "https?://[^\"']+" iot-app-unpacked/res/ | grep -v "google\|android"

# 3. Find API keys
grep -r "api\|key" iot-app-unpacked/res/values/strings.xml

# 4. Locate device communication code
find iot-app-unpacked/smali -name "*Device*.smali"
find iot-app-unpacked/smali -name "*Network*.smali"
find iot-app-unpacked/smali -name "*Api*.smali"

# 5. Check for certificate pinning
grep -r "certificatePinner\|TrustManager" iot-app-unpacked/smali/

Workflow 3: Resource Extraction Only

# Fast resource-only extraction
apktool d app.apk -o app-resources -s

# Extract app icon
cp app-resources/res/mipmap-xxxhdpi/ic_launcher.png ./

# Extract strings for localization
cat app-resources/res/values*/strings.xml

# Extract layouts for UI analysis
ls app-resources/res/layout/

Workflow 4: Quick Code Check (No Resources)

# Fast code-only extraction
apktool d app.apk -o app-code -r

# Analyze smali quickly
grep -r "http" app-code/smali/ | head -20
grep -r "password" app-code/smali/

Output Formats

Apktool doesn't have built-in output format options, but you can structure your analysis:

For human-readable reports:

# Generate analysis report
{
  echo "=== APK Analysis Report ==="
  echo "APK: app.apk"
  echo "Date: $(date)"
  echo ""
  echo "=== Permissions ==="
  grep "uses-permission" app-unpacked/AndroidManifest.xml
  echo ""
  echo "=== Exported Components ==="
  grep "exported=\"true\"" app-unpacked/AndroidManifest.xml
  echo ""
  echo "=== Package Info ==="
  grep "package=" app-unpacked/AndroidManifest.xml
} > apk-analysis-report.txt

Integration with IoTHackBot Tools

Apktool works well with other analysis workflows:

  1. APK → Network Analysis:

    • Extract API endpoints from resources
    • Use extracted URLs with curl/wget for testing
    • Feed endpoints to network testing tools
  2. APK → Credential Discovery:

    • Find hardcoded credentials in resources
    • Test credentials against IoT devices
    • Use with onvifscan or other device testing tools
  3. APK → Code Analysis:

    • Extract smali code with apktool
    • Decompile to Java with jadx for easier reading
    • Cross-reference findings between both tools

Best Practices

1. Always Examine the Manifest First

apktool d app.apk -o app-unpacked
cat app-unpacked/AndroidManifest.xml | less

The manifest provides the roadmap for further analysis.

2. Use Selective Decoding for Speed

  • Code only: -r flag
  • Resources only: -s flag
  • Full decode: No flags (default)

3. Search Systematically

# Create analysis script
cat > analyze.sh << 'EOF'
#!/bin/bash
APK_DIR="$1"
echo "[+] Searching for URLs..."
grep -rE "https?://" "$APK_DIR/res/" | grep -v "schema\|google\|android"
echo "[+] Searching for API keys..."
grep -ri "api.*key\|apikey" "$APK_DIR/res/"
echo "[+] Searching for secrets..."
grep -ri "secret\|password\|credential" "$APK_DIR/res/"
EOF
chmod +x analyze.sh
./analyze.sh app-unpacked

4. Document Your Findings

Keep notes on:

  • APK package name and version
  • Interesting permissions
  • Hardcoded credentials/URLs
  • Exported components
  • Security misc

Content truncated.

When not to use it

  • Analyzing non-Android executable formats
  • Debugging signed production-only code without source access

Prerequisites

Apktool installedJava Runtime Environment

Limitations

  • Code is often obfuscated and hard to read
  • Rebuilding modified APKs may break digital signatures
  • Does not provide full source code recovery

How it compares

Standardizes the disassembly process for security analysis rather than simple extraction of compressed files.

Compared to similar skills

apktool side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
apktool (this skill)72moReviewIntermediate
reverse-engineering-tools734moNo flagsAdvanced
ghidra167moReviewAdvanced
mobile-security143moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

More by BrownFineSecurity

View all by BrownFineSecurity

ffind

BrownFineSecurity

Advanced file finder with type detection and filesystem extraction for analyzing firmware and extracting embedded filesystems. Use when you need to analyze firmware files, identify file types, or extract ext2/3/4 or F2FS filesystems.

16

iotnet

BrownFineSecurity

IoT network traffic analyzer for detecting IoT protocols and identifying security vulnerabilities in network communications. Use when you need to analyze network traffic, identify IoT protocols, or assess network security of IoT devices.

10

jadx

BrownFineSecurity

Android APK decompiler that converts DEX bytecode to readable Java source code. Use when you need to decompile APK files, analyze app logic, search for vulnerabilities, find hardcoded credentials, or understand app behavior through readable source code.

116

logicmso

BrownFineSecurity

Analyze digital and analog captures from Saleae Logic MSO devices. Decode protocols like UART, SPI, I2C from exported binary files. Use when analyzing logic analyzer captures for CTF challenges, hardware reverse engineering, or protocol decoding.

12

netflows

BrownFineSecurity

Network flow extractor that analyzes pcap/pcapng files to identify outbound connections with automatic DNS hostname resolution. Use when you need to enumerate network destinations, identify what hosts a device communicates with, or map IP addresses to hostnames from packet captures.

18

nmap

BrownFineSecurity

Professional network reconnaissance and port scanning using nmap. Supports various scan types (quick, full, UDP, stealth), service detection, vulnerability scanning, and NSE scripts. Use when you need to enumerate network services, detect versions, or perform network reconnaissance.

16

You might also like

reverse-engineering-tools

gmh5225

Guide for reverse engineering tools and techniques used in game security research. Use this skill when working with debuggers, disassemblers, memory analysis tools, binary analysis, or decompilers for game security research.

73204

ghidra

mitsuhiko

Reverse engineer binaries using Ghidra's headless analyzer. Decompile executables, extract functions, strings, symbols, and analyze call graphs without GUI.

16105

mobile-security

gmh5225

Guide for mobile game security on Android and iOS platforms. Use this skill when working with Android/iOS reverse engineering, mobile game hacking, APK analysis, root/jailbreak detection bypass, or mobile anti-cheat systems.

1469

firmware-analyst

sickn33

Expert firmware analyst specializing in embedded systems, IoT security, and hardware reverse engineering. Masters firmware extraction, analysis, and vulnerability research for routers, IoT devices, automotive systems, and industrial controllers. Use PROACTIVELY for firmware security audits, IoT penetration testing, or embedded systems research.

947

memory-forensics

wshobson

Master memory forensics techniques including memory acquisition, process analysis, and artifact extraction using Volatility and related tools. Use when analyzing memory dumps, investigating incidents, or performing malware analysis from RAM captures.

748

binary-analysis-patterns

wshobson

Master binary analysis patterns including disassembly, decompilation, control flow analysis, and code pattern recognition. Use when analyzing executables, understanding compiled code, or performing static analysis on binaries.

540

Search skills

Search the agent skills registry