Evidence-driven tooling for authorized web application and API assessments. Gungnir separates agent reasoning from deterministic scope enforcement, bounded technical actions, evidence storage, finding validation, passive correlation and analytical reporting and explicitly authorized remediation verification.
The implementation includes recon, passive application mapping, authentication, API, web and business-logic testing, independent candidate validation and passive attack-chain analysis, reviewed assessment reporting and intelligent bounded retesting. It is an operator-driven engineering project: the Python runtime does not call an LLM, and the OpenCode orchestrator cannot provision its own authorization or tasks.
Operator: authorization + scope + identities + disposable fixtures
|
Python Orchestrator / local state
|
OpenCode specialist + methodology skill
|
fixed native tool -> Python bridge -> ToolGateway
|
scope + task + phase + action-policy checks
|
named adapter -> evidence + audit log
src/gungnir/: Pydantic contracts, workflow, scope/policy, adapters and services..opencode/agents/: primary coordinator and specialist definitions..opencode/skills/: reusable testing methodology; not additional executors..opencode/tools/: native bridge tools with fixed capabilities.config/engagement.example.yaml: operator-owned engagement contract.workspace/,evidence/,reports/: local sensitive artifacts, ignored by Git.
The diagram shows active operations; mapping, correlation and reporting tools instead read existing local evidence without network adapters.
See architecture, ToolGateway and the OpenCode bridge contract.
| Area | Current implementation | Boundary |
|---|---|---|
| Scope and workflow | Authorization validation, allow/exclude rules, task/phase binding, pause/retry and audit events | Trusted operator owns configuration and state |
| Recon | Bounded HTTP GET/HEAD and DNS frontier | No brute force, generic fuzzing or scope expansion |
| Mapping | Passive analysis of captured evidence | No new target requests |
| Authentication | Mapped login/session and access comparisons | Explicit test identities and fixtures |
| API | Mapped REST/JSON and known GraphQL operations | Read-only by default; mutations require reversible operator fixtures |
| Web | Fixed, evidence-backed profiles for selected classes | Other classes remain observations; no general browser exploitation engine |
| Business logic | Bounded workflow/invariant checks and independent readback | Operator-defined workflows, disposable fixtures and cleanup |
| Finding validation | Fresh deterministic checks for producer-backed candidate families | Missing prerequisites/executors produce inconclusive, not validation |
| Attack chains / correlation | Deterministic capabilities, bounded typed graphs, confirmed/partial chains and root-cause relationships | Validated evidence only; passive, no exploit escalation |
| Analytical reporting | Frozen facts → agent synthesis → reviewed JSON/Markdown assessment | Passive; validated-only vulnerabilities, cited analysis, deterministic CVSS/checks |
| Retests | Agent hypotheses/choices/interpretation, reused safe verifiers, separate JSON/Markdown and audited outcomes | Renewed authorization; original claim/evidence immutable; no absence-only fixes or unrelated discovery |
Findings begin as candidate. Promotion to validated, false_positive or
inconclusive requires a persisted Phase 9 outcome bound to the exact claim,
scope, configuration, mapping, identities, fixtures and original evidence.
LLM prose cannot promote a finding. “Validated” means the implemented profile's
criteria were met; for example, XSS checks analyze response context, not browser
execution. Use the detailed coverage matrix
when interpreting results.
Phases 7–11 have explicit completion gates. Unfinished cleanup blocks completion; correlation and reporting recheck input/analysis snapshots. Reporting requires a hash-bound analyst review and stops without starting retesting.
Pipeline: Scope → Recon → Mapping → Auth → API → Web → Business Logic → Validation → Attack Chain / Correlation → Analytical Reporting → explicitly authorized Retest → COMPLETED.
Retest is optional and never automatic; explicit closure without retest remains available after reviewed reporting. Gungnir v1 is feature-frozen after Phase 12 pending a dedicated architecture and agentic-reasoning evaluation. Synthetic analyst tests and loopback workflows are not proof of actual LLM decision quality.
Requirements: Python 3.11+, a POSIX workstation, and Bun 1.4.3+ for native
tool checks. OpenCode is needed only for agent integration; bridge documentation
records the original 1.18.33 integration, and the development plugin dependency
is pinned in .opencode/package.json.
git clone https://github.com/binaryTob/gungnir-pentester.git
cd gungnir-pentester
python3 -m venv .venv
.venv/bin/python -m pip install -e '.[dev]'
bun install --cwd .opencode --frozen-lockfileThe Python editable installation is required by the fixed .venv/bin/python -I
bridge invocation. Select pentest-orchestrator in OpenCode after installation.
Quit and restart OpenCode after changing configuration, agents or native tools.
- Obtain written authorization and an exact scope.
- Copy
config/engagement.example.yamltoconfig/engagement.yaml(Git-ignored). Replace the example metadata, inclusions, exclusions, protocols and ports. Setauthorization_confirmed: trueonly after authorization is confirmed. - In the repository root, run the following through
.venv/bin/python:
from pathlib import Path
from gungnir.orchestrator import Orchestrator
from gungnir.models import Phase
run = Orchestrator.initialize(
Path("config/engagement.yaml"), Path("workspace/<engagement-id>")
)
run.advance(Phase.SCOPE_VALIDATED)
decision = run.authorize("https://example.test/")
print(decision.model_dump_json(indent=2))Replace <engagement-id> with the configured ID. This creates local state and
evaluates scope; it does not connect to the target. .test is reserved for
examples. Never reuse a workspace for another engagement.
An actual task must be provisioned by the trusted Python operator. For an
explicitly authorized loopback application, advance to RECON, then call
run.create_recon_task("http://127.0.0.1:8080/"). Follow the phase documentation
for subsequent task APIs, queued action IDs, fixture prerequisites and budgets.
Starting OpenCode alone does not initialize an engagement or execute every phase.
After VALIDATION_COMPLETED, explicitly enter ATTACK_CHAIN_ANALYSIS and call
run.create_correlation_task(). The specialist uses queued IDs only. Capabilities,
typed graphs, confirmed/partial paths and conservative duplicate/root-cause links
come from validated evidence; no requests, new candidates, arbitrary graph edges
or severity increases are allowed. The phase stops at CORRELATION_COMPLETED,
without reporting or retesting. See ATTACK_CHAIN_ANALYSIS.md.
After CORRELATION_COMPLETED, explicitly enter REPORTING and provision
run.create_reporting_task(). The reporting specialist inspects frozen facts,
chooses relevant analytical actions, persists a distinct AssessmentSynthesis,
and reviews the assembled JSON/Markdown before REPORTING_COMPLETED. Themes,
root-cause remediation, priorities and summaries are agent judgments, not a
sequential template loop. See REPORTING.md for the strict
submission contracts, evidence constraints, redaction and human-review limits.
| Specialist | Native tool |
|---|---|
recon-agent |
gungnir_execute_tool |
application-mapping-agent |
gungnir_map_application |
auth-session-agent |
gungnir_auth_step |
api-agent |
gungnir_api_step |
web-vulnerability-agent |
gungnir_web_step |
business-logic-agent |
gungnir_business_step |
validation-agent |
gungnir_validation_step |
attack-chain-agent |
gungnir_correlation_step |
reporting-agent |
gungnir_reporting_step |
The primary pentest-orchestrator coordinates; scope-agent interprets scope
while Python makes deterministic authorization decisions. The retest agent
remains a placeholder. Specialist tools
are denied globally and enabled only for their designated agents. All active
adapter execution passes through ToolGateway; mapping, correlation and reporting read existing evidence.
- Exclusions take precedence. DNS answers, redirects and third parties never grant authorization. HTTP adapters do not follow redirects.
- Active actions require a matching pending task and permitted phase/action. Unknown adapters, arbitrary commands and model-selected payloads are rejected.
- Stateful tests require explicit fixtures, bounded budgets and cleanup checks.
- Raw evidence is retained locally with restricted permissions, SHA-256 and sidecar metadata. Audit logs redact common secrets, but raw evidence is not sanitized for publication. Review artifacts before sharing.
- Agent permissions and bridges are not an OS sandbox. A local user with Python, filesystem or socket access is trusted. Use one writer per workspace; audit files are not tamper-evident and multi-file writes are not crash-atomic.
.venv/bin/python -m pytest -qThe suite uses mocks and local loopback HTTP fixtures. Bun enables native-tool binding tests; without it those checks are skipped. CI installs Bun and the pinned plugin dependency so they run. CI also scans Git history for secrets. These checks do not establish production readiness or live-target effectiveness.