Skip to content

hgxszhj/https-github.com-zhaoxuya520-reverse-skill / skills/apk-reverse

apk-reverse

Flagged

在 CLI 环境下做 Android APK 逆向时使用。适用于 APK 解包、Java 反编译、smali 修改、重打包、Frida 动态 Hook,以及按需切换到 so/native 分析。优先使用本机已安装的 jadx、apktool、frida、adb、ida-reverse、radare2。

scripts/frida-run.sh

View on GitHub
#!/usr/bin/env bash
# frida-run.sh — Frida 动态注入脚本
# 等价于 Windows 版的 frida-run.ps1
#
# 用法:
#   bash frida-run.sh --package <pkg> --script <js> [--usb] [--spawn]
#   bash frida-run.sh --list-devices
#   bash frida-run.sh --list-processes [--usb]

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
KALI_BOOTSTRAP="$(cd "$SCRIPT_DIR/../../../kali/scripts" 2>/dev/null && pwd)/bootstrap-reverse.sh"

# ─── 参数 ──────────────────────────────────────────────────────────────────────────

PACKAGE=""
PROCESS=""
REMOTE_HOST="127.0.0.1:27042"
SCRIPT_PATH=""
USB=false
SPAWN=false
PAUSE=false
LIST_DEVICES=false
LIST_PROCESSES=false

while [[ $# -gt 0 ]]; do
    case "$1" in
        --package|-p) PACKAGE="$2"; shift 2 ;;
        --process) PROCESS="$2"; shift 2 ;;
        --remote|-H) REMOTE_HOST="$2"; shift 2 ;;
        --script|-l) SCRIPT_PATH="$2"; shift 2 ;;
        --usb|-U) USB=true; shift ;;
        --spawn|-f) SPAWN=true; shift ;;
        --pause) PAUSE=true; shift ;;
        --list-devices) LIST_DEVICES=true; shift ;;
        --list-processes) LIST_PROCESSES=true; shift ;;
        -*) echo "未知选项: $1"; exit 1 ;;
        *) echo "未知参数: $1"; exit 1 ;;
    esac
done

# ─── 工具检测 ──────────────────────────────────────────────────────────────────────

ensure_frida() {
    if command -v frida &>/dev/null; then
        return 0
    fi
    echo "INFO: frida 未找到,尝试安装..."
    if [[ -x "$KALI_BOOTSTRAP" ]]; then
        bash "$KALI_BOOTSTRAP" frida --skip-refresh 2>/dev/null || true
    fi
    if ! command -v frida &>/dev/null; then
        echo "ERR: frida 不可用。安装: pip3 install frida-tools"
        exit 1
    fi
}

ensure_frida

# ─── 列出设备 ──────────────────────────────────────────────────────────────────────

if [[ "$LIST_DEVICES" == "true" ]]; then
    frida-ls-devices 2>/dev/null || python3 -c "
import frida
for d in frida.enumerate_devices():
    print(f'{d.id}\t{d.type}\t{d.name}')
"
    exit 0
fi

# ─── 列出进程 ──────────────────────────────────────────────────────────────────────

if [[ "$LIST_PROCESSES" == "true" ]]; then
    if [[ "$USB" == "true" ]]; then
        frida-ps -U
    else
        frida-ps -H "$REMOTE_HOST"
    fi
    exit 0
fi

# ─── 注入执行 ──────────────────────────────────────────────────────────────────────

TARGET="${PACKAGE:-$PROCESS}"
if [[ -z "$TARGET" ]]; then
    echo "用法: $0 --package <pkg> --script <js> [--usb] [--spawn]"
    echo "  或: $0 --list-devices"
    echo "  或: $0 --list-processes [--usb]"
    exit 1
fi

if [[ -z "$SCRIPT_PATH" || ! -f "$SCRIPT_PATH" ]]; then
    echo "ERR: Frida 脚本不存在: ${SCRIPT_PATH:-未指定}"
    exit 1
fi

FRIDA_ARGS=()

if [[ "$USB" == "true" ]]; then
    FRIDA_ARGS+=("-U")
else
    FRIDA_ARGS+=("-H" "$REMOTE_HOST")
fi

if [[ "$SPAWN" == "true" ]]; then
    FRIDA_ARGS+=("-f")
else
    FRIDA_ARGS+=("-n")
fi

FRIDA_ARGS+=("$TARGET")
FRIDA_ARGS+=("-l" "$SCRIPT_PATH")

if [[ "$PAUSE" != "true" ]]; then
    FRIDA_ARGS+=("--no-pause")
fi

echo "=== Frida 注入 ==="
echo "  目标: $TARGET"
echo "  脚本: $SCRIPT_PATH"
echo "  模式: $([ "$SPAWN" == "true" ] && echo "spawn" || echo "attach")"
echo "  连接: $([ "$USB" == "true" ] && echo "USB" || echo "$REMOTE_HOST")"
echo ""

frida "${FRIDA_ARGS[@]}"
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 193kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 193kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 193kUpdated Claude CodeCodexVerifiedInstall