Skip to content

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

radare2

Verified

Use this skill whenever the user wants to analyze binaries with radare2/r2 from the command line, including reverse engineering, disassembly, function analysis, strings/import inspection, patching, binary diffing, hex inspection, or r2 scripting. Also use it when the user mentions PE/ELF/Mach-O/DEX/WASM files together with CLI analysis, `rabin2`, `rasm2`, `radiff2`, `r2pipe`, or asks for radare2 command help on Windows/Linux/macOS.

FileKindSize
SKILL.mdskill md14.1 KB
references/cheatsheet.mdmarkdown1.6 KB
scripts/recon.ps1script2.6 KB
scripts/recon.shscript2.9 KB

scripts/recon.sh

View on GitHub
#!/usr/bin/env bash
# recon.sh — radare2 快速侦察(二进制基本信息、节区、导入导出、字符串)
# 等价于 Windows 版的 recon.ps1
#
# 用法:
#   bash recon.sh <target_file> [--strings-limit 40] [--imports-limit 80] [--analyze]

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"

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

TARGET=""
STRINGS_LIMIT=40
IMPORTS_LIMIT=80
RUN_ANALYSIS=false

while [[ $# -gt 0 ]]; do
    case "$1" in
        --strings-limit) STRINGS_LIMIT="$2"; shift 2 ;;
        --imports-limit) IMPORTS_LIMIT="$2"; shift 2 ;;
        --analyze) RUN_ANALYSIS=true; shift ;;
        -*) echo "未知选项: $1"; exit 1 ;;
        *) TARGET="$1"; shift ;;
    esac
done

if [[ -z "$TARGET" ]]; then
    echo "用法: $0 <target_file> [--strings-limit N] [--imports-limit N] [--analyze]"
    exit 1
fi

if [[ ! -f "$TARGET" ]]; then
    echo "ERR: 文件不存在: $TARGET"
    exit 1
fi

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

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

ensure_tool "rabin2"
[[ "$RUN_ANALYSIS" == "true" ]] && ensure_tool "r2"

# ─── 绝对路径 ──────────────────────────────────────────────────────────────────────

TARGET="$(realpath "$TARGET")"
echo "目标文件: $TARGET"

# ─── 侦察 ─────────────────────────────────────────────────────────────────────────

echo ""
echo "=== 基本信息 ==="
rabin2 -I -- "$TARGET"

echo ""
echo "=== 节区 ==="
rabin2 -S -- "$TARGET"

echo ""
echo "=== 导入 ==="
rabin2 -i -- "$TARGET" | head -n "$IMPORTS_LIMIT"

echo ""
echo "=== 导出 ==="
rabin2 -E -- "$TARGET"

echo ""
echo "=== 字符串 ==="
rabin2 -zz -- "$TARGET" | head -n "$STRINGS_LIMIT"

if [[ "$RUN_ANALYSIS" == "true" ]]; then
    echo ""
    echo "=== 函数与入口分析 ==="
    r2 -A -q -c 's entry0;afl;iz;ii;q' -- "$TARGET"
fi
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 319kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 319kUpdated Claude CodeCodexVerifiedInstall