Skip to main content
opfor hunt runs an autonomous red-team campaign. Instead of a fixed suite, you give it an objective and a multi-agent system does the rest — reconnaissance, strategy, adaptive multi-turn attacks, self-judging, and a full report. It’s powered by the Claude Agent SDK, so it needs an Anthropic-compatible key (direct or via OpenRouter) to drive the agents.

Quickstart

Add --ui to watch the attack tree unfold in a live dashboard.
Set ANTHROPIC_API_KEY (or OPENROUTER_API_KEY) for the agents that drive the campaign. --target-key-env points to the key for the target you’re attacking — they’re separate.

How it works

Three agent roles divide the work, each on a model tier suited to its job: The campaign starts with recon, then the commander spawns operators to pursue leads, forking new threads as it finds weak points — until the objective is met or a limit is hit.

Options

Local-script targets

For targets that can’t be modeled as a simple HTTP request/response — async/polling APIs, session ids embedded in a URL path segment, or auth flows needing custom logic — point opfor hunt at a local script adapter instead of an endpoint. It uses the same type: "local-script" shape and stdin/stdout contract as opfor run (see the local script contract).
target.json
There is no --endpoint, --script-path, or similar flag for this — local-script targets are configured only via --target-config. --name still overrides the display name (it defaults to the script’s basename).
Hunt’s per-thread threadId is passed to the script as sessionId, so each forked attack thread gets an isolated session automatically — no extra wiring needed. The script has 240 seconds per turn to respond before it’s killed.

Authentication

Credentials for the agents that drive the campaign are resolved in order:
  1. ANTHROPIC_API_KEY — pay-per-token Anthropic API key.
  2. CLAUDE_CODE_OAUTH_TOKEN — token from claude setup-token.
  3. Local Claude subscription — falls back to your claude login session (Pro/Max) if neither is set, using that subscription’s usage/rate limits.
Options 2 and 3 require the Claude Code CLI (npm install -g @anthropic-ai/claude-code). Gateway / self-hosted proxy (e.g. OpenRouter) — set both together (a token without a base URL is ignored):

What it probes

The agents draw on a built-in library of vulnerability classes, personas, and strategies, and combine them adaptively.

Troubleshooting

Check ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL are set correctly for the agent models.
Lower --max-operators or --budget-usd to reduce concurrency and total calls.

Programmatic equivalent

The same campaign is available as hunt() in the SDK, with progress streaming.