Ghidra re skill main

From lza6/Armor-piercing-system-prompts · View interactive version

Ghidra re skill main is an AI agent skill from the GitHub repository lza6/Armor-piercing-system-prompts. Use for Ghidra-based reverse engineering on this machine, especially Apple Mach-O and dyld-extracted binaries. Trigger when the user wants headless Ghidra import/analysis, to run Ghidra scripts, inspect decompilation, or export structured reversing artifacts such as functions, strings, symbols, Obje

How to use this skill

Skill file

Ghidra RE

Use this skill for repeatable, headless-first Ghidra work on macOS or Windows. It assumes:

The skill is host-agnostic. Every script under scripts/ resolves its own root from $BASH_SOURCE, so there is no hardcoded install location. The unified host layer lives in scripts/lib/skill_host.sh and is the single source of truth for Codex vs Claude Code install paths. Use scripts/install_skill --host auto|codex|claude|both to copy the checkout into one or more hosts.

Resolving the Skill Root

Before running any scripts/ command, resolve SKILL_ROOT with this one-liner. It checks the standard install locations first, then searches Claude Code's plugin directory as a fallback — covering every load path automatically:

SKILL_ROOT="$(
  for p in \
    "${CODEX_HOME:-$HOME/.codex}/skills/ghidra-re" \
    "${CLAUDE_HOME:-$HOME/.claude}/skills/ghidra-re"; do
    [[ -f "$p/SKILL.md" ]] && printf '%s' "$p" && break
  done
)" ; [[ -z "$SKILL_ROOT" ]] && SKILL_ROOT="$(
  find "$HOME/Library/Application Support/Claude/local-agent-mode-sessions/skills-plugin" \
    -maxdepth 5 -name 'SKILL.md' -path '*/ghidra-re/SKILL.md' 2>/dev/null \
    | head -1 | xargs -I{} dirname {}
)"
echo "Skill root: $SKILL_ROOT"

Once set, prefix every scripts/ call with "$SKILL_ROOT/":

"$SKILL_ROOT/scripts/bootstrap"
"$SKILL_ROOT/scripts/ghidra_import_analyze" <binary> [project_name]

Known root paths (for reference — use the discovery snippet above rather than hardcoding):

V1 is optimized for Apple Mach-O reversing and dyld-extracted binaries. It now includes a localhost GUI bridge extension for live inspection, annotation, and controlled program surgery inside open Ghidra sessions, plus mission workspaces for multi-target investigation across frameworks, daemons, and helpers.

The custom automation scripts ship as Java Ghidra scripts because that is the most reliable headless path on this machine.

On Windows, the public repo now also ships a native PowerShell wrapper layer in powershell/ for people who want first-class PowerShell commands instead of starting in Git Bash.

Quick Start

All scripts/ paths below are relative to $SKILL_ROOT. Run the discovery snippet in "Resolving the Skill Root" first, then prefix every command with "$SKILL_ROOT/".

  1. On a fresh machine, run "$SKILL_ROOT/scripts/bootstrap" once.
  2. If bootstrap cannot find Ghidra or Java 21, run "$SKILL_ROOT/scripts/doctor".
  3. On Windows, if the targets live in a mounted or extracted macOS image, register that source first:
  1. Start a multi-target mission when the task spans more than one framework, daemon, or helper:
  1. Extend the mission with a seed-driven trace:
  1. For a more autonomous pass, let the mission keep driving its own next hops:
  1. Read the mission report:
  1. Finish the mission and close its live Ghidra sessions unless you explicitly keep them open:
  1. For a single target, import and analyze into a dedicated project:
  1. Export the default Apple-focused bundle:
  1. For Swift-heavy Apple targets, resolve _OUTLINED_FUNCTION_* stubs before exporting or decompiling — this is essential for any dyld-extracted binary (WorkflowKit, BackgroundTaskAgent, etc.) where the Swift compiler outlined ARC/copy/move helpers:
  1. Generate a surface-level report before chasing individual mangled symbols:
  1. Export the bug-hunt bundle only when the task is explicitly bug hunting or boundary triage:
  1. Generate a function dossier for a top candidate:
  1. Apply a finding back into the project when you confirm something interesting:
  1. Run an extra script when needed:
  1. Record any friction or missing-feature notes through the shared notes flow before you wrap up the session:
  1. Open the project in the GUI:
  1. Arm or reuse the live bridge when you want an interactive RE loop:
  1. Use the live bridge wrappers for inspection or edits:
  1. Use the dyld-aware macOS import helper when a framework path comes from a live system image or extracted source root:
  1. Build a one-file macOS share bundle when you want to hand the skill and Ghidra to another desktop:
  1. Build a one-file Windows share bundle when you want easy installation on a Windows machine:
  1. On Windows, optionally import the native module after install:
  1. Run the explicit polish pass before serious testing or publishing:

Default Workflow

1) Import into the dedicated workspace

2) Use missions for cross-target work

3) Resolve Swift outlined functions (Swift-heavy binaries only)

4) Use the Apple export bundle

5) Use targeted scripts for follow-up

6) Use the live bridge for iterative GUI sessions

Command Surface

Run these wrappers from the skill directory:

11b. For runtime analysis of binaries you can launch or attach to, use the LLDB integration tools:

Script argument style

Built-ins Vs Custom Scripts

Use scripts/ghidra_run_script for both built-ins and custom scripts. It adds the custom script directory and the common built-in Ghidra script directories to -scriptPath.

References

Read only what you need:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.