binary-re-tool-setup
Use when reverse engineering tools are missing, not working, or need configuration. Installation guides for radare2 (r2), Ghidra, GDB, QEMU, Frida, binutils, and cross-compilation toolchains. Keywords - "install radare2", "setup ghidra", "r2 not found", "qemu missing", "tool not installed", "configure gdb", "cross-compiler"
What this skill does
# Tool Setup
## Purpose
Ensure required reverse engineering tools are available and properly configured for cross-architecture analysis.
## When to Use
- Before first analysis session
- When tool commands fail
- Setting up new analysis environment
- Updating to newer tool versions
## Required Tools
| Tool | Purpose | Priority |
|------|---------|----------|
| radare2 | Static analysis, disassembly | **Required** |
| rabin2 | Fast binary triage | **Required** (part of r2) |
| qemu-user | Cross-arch emulation | **Required** |
| gdb-multiarch | Cross-arch debugging | **Required** |
| Ghidra | Decompilation | Recommended |
| GEF | GDB enhancements | Recommended |
| Frida | Dynamic instrumentation | Optional |
| Unicorn | Snippet emulation | Optional |
| Angr | Symbolic execution | Optional |
## Installation by Platform
### Ubuntu/Debian
```bash
# Core tools
sudo apt update
sudo apt install -y \
radare2 \
qemu-user \
qemu-user-static \
gdb-multiarch \
binutils-multiarch \
jq # Required for JSON parsing in skill commands
# ARM sysroots (for QEMU)
sudo apt install -y \
libc6-armhf-cross \
libc6-arm64-cross \
libc6-dev-armhf-cross \
libc6-dev-arm64-cross
# Additional utilities
sudo apt install -y \
file \
binutils \
elfutils \
patchelf
```
### Windows (WSL2)
Windows users should use WSL2 with Ubuntu for full compatibility:
```powershell
# PowerShell (Administrator) - Install WSL2 with Ubuntu
wsl --install -d Ubuntu
# Restart computer when prompted, then open Ubuntu terminal
```
Inside WSL2 Ubuntu:
```bash
# Install all required tools
sudo apt update && sudo apt install -y \
radare2 \
qemu-user \
qemu-user-static \
gdb-multiarch \
binutils-multiarch \
jq \
file \
patchelf
# Fix file permissions for Windows-mounted drives
sudo tee -a /etc/wsl.conf > /dev/null << 'EOF'
[automount]
options = "metadata,umask=22,fmask=11"
EOF
# Restart WSL to apply changes
# (In PowerShell: wsl --shutdown)
```
**WSL2 Tips:**
- Copy binaries into `~` rather than using `/mnt/c/...` paths (fewer permission issues)
- Use `wsl --shutdown` in PowerShell to restart WSL after config changes
- Docker Desktop integrates with WSL2 for container-based analysis
### macOS (Homebrew)
```bash
# Core tools
brew install radare2 jq
# NOTE: Homebrew QEMU may lack qemu-user targets
# Verify: qemu-arm --version || echo "qemu-user missing"
# If missing, use Docker for cross-arch execution (see below)
# GDB requires special handling on macOS
brew install gdb
# Note: Code signing required for debugging
# ARM cross tools (optional, for static analysis only)
brew install arm-linux-gnueabihf-binutils
```
### macOS Docker Setup for Dynamic Analysis
Since Homebrew doesn't provide `qemu-user`, use Docker for cross-architecture execution:
```bash
# Install Docker runtime (Colima is lightweight alternative to Docker Desktop)
brew install colima docker
# Start Colima
colima start
# Register multi-architecture emulation handlers
docker run --rm --privileged --platform linux/arm64 \
tonistiigi/binfmt --install arm
# Verify ARM32 emulation works
docker run --rm --platform linux/arm/v7 arm32v7/debian:bullseye-slim uname -m
# Should output: armv7l
# Verify ARM64 emulation works
docker run --rm --platform linux/arm64 arm64v8/debian:bullseye-slim uname -m
# Should output: aarch64
# Verify x86-32 emulation works
docker run --rm --platform linux/i386 i386/debian:bullseye-slim uname -m
# Should output: i686
```
**IMPORTANT:** On Colima, always mount from `~/` not `/tmp/`:
```bash
# ✅ Works
docker run -v ~/samples:/work ...
# ❌ May fail silently
docker run -v /tmp/samples:/work ...
```
### Arch Linux
```bash
sudo pacman -S radare2 qemu-user gdb
yay -S arm-linux-gnueabihf-glibc # From AUR
```
## Tool-Specific Setup
### radare2
```bash
# Verify installation
r2 -v
rabin2 -v
# Install r2ghidra plugin (decompilation)
r2pm init
r2pm update
r2pm -ci r2ghidra # -ci = clean install
# Verify r2ghidra is working (CRITICAL CHECK)
r2 -qc 'pdg?' - 2>/dev/null | grep -q Usage && echo "r2ghidra OK" || echo "r2ghidra MISSING"
# Alternative verification
r2 -c 'Ld' /bin/ls | grep -i ghidra
```
**Common r2ghidra issues:**
| Symptom | Cause | Fix |
|---------|-------|-----|
| `pdg` unknown command | Plugin not loaded | `r2pm -ci r2ghidra` |
| Plugin loads but crashes | Version mismatch | Update both r2 and plugin |
| Decompilation hangs | Large function | Use `pdf` instead, or Ghidra headless |
**Configuration (~/.radare2rc):**
```
# Disable colors for scripting
e scr.color=false
# Increase analysis limits
e anal.timeout=120
e anal.maxsize=67108864
# JSON output by default for scripts
e cfg.json.num=true
```
### Ghidra (Headless)
```bash
# Download from https://ghidra-sre.org/
# Extract to /opt/ghidra
# Verify headless script
/opt/ghidra/support/analyzeHeadless --help
# Add to PATH
echo 'export PATH=$PATH:/opt/ghidra/support' >> ~/.bashrc
```
**Memory configuration (for large binaries):**
Edit `/opt/ghidra/support/analyzeHeadless`:
```bash
MAXMEM=4G # Increase from default
```
### GEF (GDB Enhanced Features)
```bash
# Install GEF
bash -c "$(curl -fsSL https://gef.blah.cat/sh)"
# Verify
gdb -q -ex "gef help" -ex "quit"
# For ARM Cortex-M support, also install gef-extras
git clone https://github.com/hugsy/gef-extras.git ~/.gef-extras
echo 'source ~/.gef-extras/scripts/checksec.py' >> ~/.gdbinit
```
### Frida
```bash
# Install Frida tools
pip install frida-tools
# Verify
frida --version
# Install frida-server for device debugging (optional)
# Download from https://github.com/frida/frida/releases
```
### Unicorn (Python bindings)
```bash
pip install unicorn
# Verify
python -c "from unicorn import *; print('OK')"
```
### Angr
```bash
# Create virtual environment (recommended)
python -m venv ~/angr-venv
source ~/angr-venv/bin/activate
# Install angr
pip install angr
# Verify
python -c "import angr; print('OK')"
```
### YARA
```bash
# Ubuntu/Debian
sudo apt install yara
# Or from source for latest
git clone https://github.com/VirusTotal/yara.git
cd yara
./bootstrap.sh
./configure
make && sudo make install
# Python bindings
pip install yara-python
```
## Sysroot Setup
### Standard Debian/Ubuntu Sysroots
Already installed via `libc6-*-cross` packages:
```bash
# Verify paths
ls /usr/arm-linux-gnueabihf/lib/
ls /usr/aarch64-linux-gnu/lib/
```
### Custom Sysroot from Device
```bash
# Pull from device via SSH
mkdir -p ~/sysroots/device
ssh user@device "tar czf - /lib /usr/lib" | tar xzf - -C ~/sysroots/device
# Or minimal extraction
ssh user@device "tar czf - /lib/ld-* /lib/libc.* /lib/libpthread.* /lib/libdl.*" \
| tar xzf - -C ~/sysroots/device
```
### Musl Sysroot
```bash
# From Alpine Linux
docker run -it --rm -v ~/sysroots:/out alpine:latest sh -c \
"apk add musl musl-dev && cp -a /lib /usr /out/alpine-musl"
```
## Verification Script
Run this to verify all tools are working:
```bash
#!/bin/bash
set -e
echo "=== Binary RE Tool Verification ==="
# radare2
echo -n "radare2: "
r2 -v | head -1
# rabin2
echo -n "rabin2: "
rabin2 -v | head -1
# QEMU
echo -n "qemu-arm: "
qemu-arm --version | head -1
echo -n "qemu-aarch64: "
qemu-aarch64 --version | head -1
# GDB
echo -n "gdb-multiarch: "
gdb-multiarch --version | head -1
# Ghidra (optional)
if command -v analyzeHeadless &> /dev/null; then
echo -n "Ghidra: "
analyzeHeadless 2>&1 | head -1 || echo "available"
else
echo "Ghidra: not installed (optional)"
fi
# Frida (optional)
if command -v frida &> /dev/null; then
echo -n "Frida: "
frida --version
else
echo "Frida: not installed (optional)"
fi
# Sysroots
echo ""
echo "=== Sysroots ==="
[ -d /usr/arm-linux-gnueabihf ] && echo "ARM hard-float: OK" || echo "ARM hard-float: MISSING"
[ -d /usr/aarch64-linux-gnu ] && echo "ARM64: OK" || echo "ARM64: MISSING"
echo ""
echo "=== Verification Complete ==="
```
## Troubleshooting
### Common Issues Quick Reference
| Symptom | Cause | Fix |
|---Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.