Skip to content
brennocmPublic

About

Self-hosted AI-powered pentest orchestration platform.

Topics

Resources

Stars

16 stars

Watchers

0 watching

Forks

Repository files navigation

PwnCortex

PwnCortex

From scan to pentest report, in one self-hosted tool for solo testers.

License

What it is

PwnCortex organizes an engagement around the actual pentest workflow: assets → findings → evidence → report.

  1. You import scanner output, and each result becomes a candidate in a triage queue.
  2. Accepted candidates become findings, with server-side CVSS, affected assets and screenshot evidence.
  3. The report comes out as a PDF from an HTML/CSS template you can edit, SysReptor-style.

It runs locally in Docker, behind an operator password, with no telemetry. With PWNCORTEX_OFFLINE=1, no request leaves the machine.

The interface and the built-in report template are in Portuguese (pt-BR); reports can also be generated in English.

Features

  • Importers: Nmap XML, Nessus (.nessus), Nuclei JSONL, Burp (issues XML), OpenVAS/Greenbone XML, masscan JSON, generic CSV and PwnCortex's own JSON. The format is detected from the content. All XML goes through defusedxml.
    • Re-importing the same file is idempotent.
    • Every import can be undone. Data another import also saw stays: undo removes only what came from that file alone.
    • .txt and .md files become notes.
  • Triage: scanner results never become findings directly. You accept, merge into an existing finding, defer or discard.
    • Shortcuts: J/K move, A accepts, M merges, L defers, X discards.
    • PwnCortex suggests the closest library template for each candidate.
    • A discarded candidate does not come back on the next scan.
    • The AI can point out duplicates across tools.
  • Findings:
    • CVSS 3.1 and 4.0 editor: each segment of the vector is clickable and the score is recalculated as you go.
    • Severity can be overridden by hand, with a justification.
    • Each finding also holds affected assets (with port), CWE, CVEs, references, and writing and remediation status for the retest.
    • Text is Markdown. Pasting or dropping a screenshot uploads it as a project attachment.
  • Library: 25 finding templates in Portuguese (AD, web, network, crypto) to create findings in one click. Export and import as JSON.
  • PDF report:
    • HTML/CSS templates with Jinja (sandboxed), rendered by WeasyPrint. The PDF has a cover, table of contents, severity chart, one finding per page, and ports and checklist appendices.
    • A live preview sits next to the text, showing the first 10 findings to stay fast; the generated PDF includes all of them. Every generation is kept as a version.
    • Templates cannot reach the network or the disk: only the project's attachments and the template's own images.
  • Assets: a virtualized table, or a graph grouped by /24 subnet or by domain and colored by the highest open severity. The detail view shows services, CPE, NSE output and linked findings.
  • Enrichment: NVD CVEs from service versions (cached and rate limited), CISA KEV flags and EPSS. All disabled in offline mode. The KEV catalog can also be imported from a file.
  • AI assistant: local Ollama or OpenRouter, in a side drawer opened with Ctrl+J that takes the open finding or asset as context. The AI suggests; nothing is saved until you apply it. It helps with:
    • drafting a finding;
    • recommendations;
    • pt-BR/en translation;
    • the executive summary;
    • analysis of an asset.
  • Checklist: 125 items (OWASP WSTG, network, AD, infrastructure) with 1–4 shortcuts and links to findings.
  • Keyboard navigation:
    • Ctrl+K opens the command palette (findings, assets, notes, actions).
    • N creates a new finding.
    • g a, g f, g t, g r go to assets, findings, triage and report.

Screens

Project overview. Open findings by severity, next steps, and imports, each one undoable.

Project overview

Triage. A scanner result arrives with a suggested library template; A accepts it and creates the finding with its assets and tool output.

Triage queue

Finding editor. The CVSS vector is edited segment by segment; score and severity are recalculated on the server.

Finding editor with the CVSS vector open

PDF report. Cover, executive summary with counts by severity, and one finding per page with its evidence.

Pages of the PDF report

Asset graph grouped by subnet Asset detail with services and findings
Assets grouped by subnet, colored by the highest open severity. Asset detail: services, CPE, NSE output and linked findings.

Running it

Requirements: Docker with the Compose plugin.

git clone https://github.com/brennocm/pwncortex.git
cd pwncortex
cp .env.example .env      # adjust if needed
./start.sh                # choose local Ollama or OpenRouter

The interface is at http://127.0.0.1:8080. The API and Ollama are only reachable inside the Compose network.

First access. The API prints a setup token to its log. Run docker compose logs api, copy the token and set the password on the setup screen. To skip this step, set PWNCORTEX_ADMIN_PASSWORD in .env before the first boot.

Databases from earlier versions are migrated automatically on startup (Alembic).

  • Old vulnerabilities become draft findings.
  • The old report draft becomes a note.
  • Back up the pwncortex-db volume before upgrading.

Environment variables

Variable Default Purpose
PWNCORTEX_BIND / PWNCORTEX_PORT 127.0.0.1 / 8080 Where the interface listens. For remote access, put it behind TLS and set PWNCORTEX_SECURE_COOKIES=1.
PWNCORTEX_ADMIN_PASSWORD empty Operator password on first boot.
PWNCORTEX_OFFLINE 0 1 blocks OpenRouter, NVD, KEV and EPSS.
LLM_PROVIDER ollama ollama or openrouter (also configurable in the interface).
OLLAMA_MODEL qwen2.5:3b Local model.
OPENROUTER_API_KEY / OPENROUTER_MODEL empty Stored encrypted in the database when set from the interface.
NVD_API_KEY empty Raises the NVD limit from 5 to 50 requests per 30 s.
PWNCORTEX_MAX_UPLOAD_MB 200 Maximum size of a scan file.
PWNCORTEX_LLM_TIMEOUT 120 Maximum LLM response time, in seconds.

Development

uv venv .venv && uv pip install -p .venv -r src/server/requirements-dev.txt
(cd src/web && npm ci)

# API with reload (port 8000) and Vite (port 5173, proxying /api)
PWNCORTEX_DATA_DIR=./data PWNCORTEX_UPLOADS_DIR=./uploads .venv/bin/uvicorn src.server.main:app --reload
(cd src/web && npm run dev)

# Or everything in containers with hot reload
docker compose -f docker-compose.yml -f docker-compose.dev.yml up

# Lint, tests and build
bin/ci

Architecture

Layer Technology
API Python 3.12, FastAPI, SQLAlchemy 2 + SQLite (WAL, FKs), Alembic
Security argon2id password, HttpOnly/SameSite=Strict session cookie, X-PwnCortex anti-CSRF header, Fernet-encrypted secrets
Jobs In-process thread pool; status in the jobs table (imports, PDF, NVD, KEV, EPSS)
Report Markdown (markdown-it + nh3), sandboxed Jinja2, WeasyPrint with a restricted fetcher
Web React 18, Vite, Tailwind, TanStack Query, React Router 7, CodeMirror 6, Cytoscape + fcose
Proxy Nginx: /api to the API, everything else to the static build, with CSP and security headers

Measured on a synthetic project with 500 hosts, 300 findings and 200 candidates:

  • lists respond in under 200 ms;
  • a 1,000-host Nmap scan imports in about 6 s;
  • the full PDF (about 430 pages) takes around 35 s, in a background job.

Code lives in src/data (models and migrations), src/domain (importers, findings, report, AI, enrichment), src/server (routes) and src/web (interface). Tests are in tests/.

Troubleshooting

  • I don't know the password / lost the token. The token appears in docker compose logs api while no password is set. With a password set, delete the admin_password_hash key from the app_settings table and restart the API to get a new token.
  • The assistant does not answer. Check Settings → Test connection. With Ollama, the model must be pulled: docker compose exec ollama ollama pull qwen2.5:3b.
  • 404 No endpoints available on OpenRouter. Relax the data policy at openrouter.ai/settings/privacy.
  • NVD refuses requests. Without a key the limit is 5 requests per 30 s. Set NVD_API_KEY or wait: the cache lasts 7 days.

Legal notice

PwnCortex is intended only for authorized security testing. Using it against systems without explicit written permission is illegal. The authors are not responsible for misuse.

License

AGPL-3.0. See LICENSE.

About

Self-hosted AI-powered pentest orchestration platform.

Topics

Resources

Stars

16 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages