jpskill.com
🛠️ 開発・MCP コミュニティ

apktool

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.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o apktool.zip https://jpskill.com/download/17604.zip && unzip -o apktool.zip && rm apktool.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17604.zip -OutFile "$d\apktool.zip"; Expand-Archive "$d\apktool.zip" -DestinationPath $d -Force; ri "$d\apktool.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して apktool.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → apktool フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Apktool - Android APK のアンパックとリソース抽出

ユーザーがセキュリティ分析、脆弱性の発見、およびアプリの内部構造の理解のために、apktool を使用して Android APK ファイルをリバースエンジニアリングするのを支援します。

ツールの概要

Apktool は、Android APK ファイルをリバースエンジニアリングするためのツールです。リソースをほぼ元の形式にデコードし、変更後にリビルドできます。これは以下にとって不可欠です。

  • 読み取り可能な AndroidManifest.xml の抽出
  • リソース (XML レイアウト、文字列、画像) のデコード
  • DEX から smali コードへの逆アセンブル
  • アプリの構造と権限の分析
  • 変更された APK の再パッケージ化

前提条件

  • apktool がシステムにインストールされている必要があります
  • Java Runtime Environment (JRE) が必要です
  • 十分なディスク容量 (アンパックされた APK は通常、元のサイズの 2〜5 倍)
  • 出力ディレクトリへの書き込み権限

手順

1. 基本的な APK のアンパック (最も一般的)

ユーザーが APK のアンパック、デコード、または分析を要求する場合:

標準的なデコードコマンド:

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

例:

apktool d app.apk -o app-unpacked

強制上書き (ディレクトリが存在する場合):

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

2. 出力構造の理解

アンパック後、出力ディレクトリには以下が含まれます。

app-unpacked/
├── AndroidManifest.xml          # 読み取り可能なマニフェスト (権限、コンポーネント)
├── apktool.yml                  # Apktool メタデータ (バージョン情報、SDK レベル)
├── original/                    # 元の META-INF 証明書
│   └── META-INF/
├── res/                         # デコードされたリソース
│   ├── layout/                  # XML レイアウト
│   ├── values/                  # 文字列、色、寸法
│   ├── drawable/                # 画像とドローアブル
│   └── ...
├── smali/                       # 逆アセンブルされた DEX コード (smali 形式)
│   └── com/company/app/        # パッケージ構造
├── assets/                      # アプリのアセット (存在する場合)
├── lib/                         # ネイティブライブラリ (存在する場合)
│   ├── arm64-v8a/
│   ├── armeabi-v7a/
│   └── ...
└── unknown/                     # Apktool が分類できなかったファイル

3. 選択的なデコード (パフォーマンスの最適化)

リソースをスキップする (コード分析のみ):

apktool d app.apk -o app-code-only -r
# or
apktool d app.apk -o app-code-only --no-res
  • より高速な処理
  • smali コードとマニフェストのみを抽出
  • コードロジックのみを分析する必要がある場合に使用

ソースコードをスキップする (リソース分析のみ):

apktool d app.apk -o app-resources-only -s
# or
apktool d app.apk -o app-resources-only --no-src
  • より高速な処理
  • リソースとマニフェストのみを抽出
  • リソース、文字列、レイアウトのみが必要な場合に使用

4. 一般的な分析タスク

A. AndroidManifest.xml の調査

マニフェストは、重要なセキュリティ情報を明らかにします。

# アンパック後
cat app-unpacked/AndroidManifest.xml

以下を探してください:

  • Permissions: アプリがアクセスするデバイスの機能/データ
  • Exported components: 他のアプリからアクセス可能なアクティビティ、サービス、レシーバー
  • Intent filters: アプリがシステム/アプリのインテントにどのように応答するか
  • Backup settings: android:allowBackup="true" (セキュリティリスク)
  • Debuggable flag: android:debuggable="true" (重大なセキュリティ問題)
  • Network security config: カスタム証明書ピンニング、クリアテキストトラフィック
  • Min/Target SDK versions: 古いバージョンには脆弱性がある可能性があります

分析コマンドの例:

# すべての権限を検索
grep "uses-permission" app-unpacked/AndroidManifest.xml

# エクスポートされたコンポーネントを検索
grep "exported=\"true\"" app-unpacked/AndroidManifest.xml

# デバッグ可能かどうかを確認
grep "debuggable" app-unpacked/AndroidManifest.xml

# すべてのアクティビティを検索
grep "android:name.*Activity" app-unpacked/AndroidManifest.xml

B. 文字列とリソースの抽出

# すべての文字列リソースを表示
cat app-unpacked/res/values/strings.xml

# API キー、URL、認証情報を検索
grep -r "api" app-unpacked/res/values/
grep -r "http" app-unpacked/res/values/
grep -r "password\|secret\|key\|token" app-unpacked/res/values/

# リソース内のハードコードされた URL を検索
grep -rE "https?://" app-unpacked/res/

C. Smali コードの分析

Smali は、逆アセンブルされた Dalvik バイトコード形式です。

# 特定のクラスを検索
find app-unpacked/smali -name "*Login*.smali"
find app-unpacked/smali -name "*Auth*.smali"

# セキュリティ関連のコードを検索
grep -r "crypto\|encrypt\|decrypt" app-unpacked/smali/
grep -r "http\|https\|url" app-unpacked/smali/
grep -r "password\|credential\|token" app-unpacked/smali/

# ネイティブライブラリの使用状況を検索
grep -r "System.loadLibrary" app-unpacked/smali/

# ファイル操作を検索
grep -r "openFileOutput\|openFileInput" app-unpacked/smali/

: Smali は Java ソースよりも読みにくいです。より簡単な分析のために、Java の逆コンパイルに jadx を使用することを検討してください。

D. ネイティブライブラリの調査

# ネイティブライブラリをリスト表示
ls -lah app-unpacked/lib/

# サポートされているアーキテクチャを確認
ls app-unpacked/lib/

# ライブラリの種類を識別
file app-unpacked/lib/arm64-v8a/*.so

# ライブラリ内の興味深い文字列を検索
strings app-unpacked/lib/arm64-v8a/libnative.so | grep -i "http\|key\|password"

5. APK の再パッケージ化 (ビルド)

リソースまたは smali コードを変更した後:

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

重要: リビルドされた APK は、インストールする前に署名する必要があります。

# キーストアの生成 (初回セットアップ)
keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-key-alias

# APK に署名
jarsigner -verbose -keystore my-release-key.jks app-modified.apk my-key-alias

# 署名の検証
jarsigner -verify app-modified.apk

# Zipalign (最適化)
zipalign -v 4 app-modified.apk app-modified-aligned.apk

6. フレームワークの管理

システムアプリ、またはデバイスメーカーのフレームワークに依存するアプリの場合:

# フレームワークのインストール
apktool if framework-res.apk

# インストールされているフレームワークのリスト表示
apktool list-frameworks

# 特定のフレームワークでデコード
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

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 misconfigurations

5. Combine with Jadx

Use both tools together:

  • Apktool: For resources, manifest, and detailed smali
  • Jadx: For readable Java source code

Troubleshooting

Problem: "brut.directory.DirectoryException: Framework"

Solution: Install framework resources:

apktool if <framework-res.apk>

Problem: Decoding fails with resource errors

Solution: Use --keep-broken-res flag:

apktool d app.apk -o output --keep-broken-res

Problem: "Input file was not found or was not readable"

Solution: Check file path and permissions:

ls -l app.apk
file app.apk  # Should show "Zip archive data"

Problem: Out of memory error

Solution: Increase Java heap size:

export _JAVA_OPTIONS="-Xmx2048m"
apktool d large-app.apk

Problem: Build fails after modifications

Solution: Validate your smali/XML syntax:

# Check for syntax errors
apktool b app-unpacked -o test.apk --use-aapt2

Problem: APK won't install after repackaging

Solution: Sign the APK:

jarsigner -verbose -keystore debug.keystore rebuilt.apk androiddebugkey

Important Notes

  • Apktool requires Java Runtime Environment (JRE)
  • Decoded APKs are typically 2-5x larger than original
  • Smali code is more verbose than Java source (use jadx for Java)
  • Always work on copies of APK files, never originals
  • Repackaging requires signing before installation
  • Some obfuscated apps may have unreadable class/method names
  • System apps may require framework installation

Security and Ethics

IMPORTANT: Only analyze APKs you own or have permission to analyze.

  • Respect intellectual property and licensing
  • Follow responsible disclosure for vulnerabilities
  • Don't distribute modified APKs without authorization
  • Be aware of terms of service and EULAs
  • Use for authorized security testing and research only

Example Analysis Session

# Complete analysis workflow
TARGET="myapp.apk"
OUTPUT="myapp-analysis"

# 1. Unpack
echo "[+] Unpacking APK..."
apktool d "$TARGET" -o "$OUTPUT"

# 2. Basic info
echo "[+] Package info:"
grep "package=" "$OUTPUT/AndroidManifest.xml"

# 3. Permissions
echo "[+] Permissions:"
grep "uses-permission" "$OUTPUT/AndroidManifest.xml"

# 4. Exported components
echo "[+] Exported components:"
grep "exported=\"true\"" "$OUTPUT/AndroidManifest.xml"

# 5. Search for secrets
echo "[+] Searching for hardcoded secrets..."
grep -r "api.*key\|password\|secret" "$OUTPUT/res/" | grep -v "^Binary"

# 6. Find URLs
echo "[+] Finding URLs..."
grep -rE "https?://[^\"']+" "$OUTPUT/res/" | grep -v "schema\|xmlns"

# 7. Check debuggable
echo "[+] Debug status:"
grep "debuggable" "$OUTPUT/AndroidManifest.xml" || echo "Not debuggable (good)"

# 8. Summary
echo "[+] Analysis complete. Output in: $OUTPUT/"

Success Criteria

A successful apktool analysis includes:

  • APK successfully decoded without errors
  • AndroidManifest.xml is readable and analyzed
  • Resources extracted and searchable
  • Smali code available for inspection
  • Security-relevant findings documented
  • Output organized in clear directory structure
  • Any modifications can be repackaged if needed

Quick Reference

# Decode (unpack)
apktool d <apk> -o <output-dir>

# Decode with force overwrite
apktool d <apk> -o <output-dir> -f

# Decode without resources (faster)
apktool d <apk> -o <output-dir> -r

# Decode without source (faster)
apktool d <apk> -o <output-dir> -s

# Build (repack)
apktool b <unpacked-dir> -o <output-apk>

# Install framework
apktool if <framework.apk>

# Empty framework cache
apktool empty-framework-dir