How xalgorix/xalgorix works
Purpose and entry points
Xalgorix is a self-hosted AI penetration-testing platform: an LLM agent executes authorized scans, an independent verifier re-tests candidate findings, and the system produces evidence-backed reports. The Go binary entry point is cmd/xalgorix/main.go; setup and OS-specific execution are in cmd/xalgorix/setup.go, cmd/xalgorix/exec_unix.go, and cmd/xalgorix/exec_windows.go. It supports CLI scans, a local web server/dashboard, and service-mode lifecycle commands.
Runtime composition
The primary runtime is Go (module metadata: go.mod), with a React/TypeScript dashboard built from webui/ and bundled into internal/web/static/. Container deployment is defined by Dockerfile, docker-compose.yml, and docker-entrypoint.sh. The intended container is a privileged, disposable scanning sandbox with Chromium and offensive tools available; native Linux is the primary supported runtime.
Scan orchestration and durable state
The web backend owns scan lifecycle, admission/scheduling, pause/resume/abort, recovery, and persisted scan records. internal/web/server.go wires HTTP/WebSocket serving; internal/web/orchestrator.go and internal/web/scheduler.go coordinate instances; internal/web/scan_record.go and internal/web/durability.go persist/recover them. Shared per-scan state—findings, notes, browser state, and terminal state—lives under internal/scanctx/context.go, internal/scanctx/vulnstore.go, and internal/scanctx/notestore.go.
Agent, methodology, and verification
internal/agent/agent.go runs the LLM-directed reasoning/tool loop. Planning and methodology guidance are separated into internal/agent/planner.go, internal/agent/plan_tools.go, and prompt/message construction files. The agent can use phase- and domain-specific skill material from internal/tools/skills/skills.go and internal/tools/skills/data/. internal/agent/verifier.go independently re-exploits candidate vulnerabilities before they become confirmed findings, forming the principal quality boundary between discovery and reporting.
Tool execution and safety boundaries
The agent accesses capabilities through a central tool registry at internal/tools/registry.go. Major adapters include terminal/process execution (internal/tools/terminal/terminal.go), HTTP traffic (internal/tools/httpclient/httpclient.go), browser automation and WebSocket bridge (internal/tools/browser/browser.go, internal/tools/browser/wsbridge.go), source/code search, file editing, Python, proxy, and out-of-band interactions. Scope and execution protections are distinct: target restrictions are enforced by internal/scopeguard/scopeguard.go; command/filesystem policy by internal/sandbox/policy.go and internal/safe/safe.go; outbound pacing by internal/ratelimit/ratelimit.go.
External services and provider boundaries
LLM communication is abstracted by internal/llm/client.go, internal/llm/router.go, and internal/llm/resolver.go, supporting provider-native and OpenAI-compatible endpoints. Authentication/profile flows for providers are implemented in internal/auth/driver.go and provider-specific drivers. Optional external integrations include AgentMail through internal/tools/agentmail/agentmail.go, out-of-band interaction infrastructure through internal/oob/interactsh.go, and configurable proxy routing via internal/proxy/manager.go.
Presentation and outputs
The backend exposes REST endpoints and live WebSocket events, with fan-out managed by internal/web/ws_hub.go. The React UI begins at webui/src/main.tsx and routes through webui/src/router.tsx; API and websocket client state are under webui/src/api/client.ts and webui/src/store/ws.ts. Confirmed findings flow into PDF/report generation in internal/reporting/generate.go, with severity/risk mapping in internal/reporting/severity.go and internal/reporting/risk.go.
Main entry points: registry.go Tool registry · agent.go LLM agent loop · orchestrator.go Scan orchestrator · server.go Web server
Components 20
Entry & deployment
- Go CLI entry · CLI, server, and service-mode commands.
cmd/xalgorix/main.go - Scanning container · Privileged disposable sandbox with browser and security tools.
Dockerfile
Web control plane
- Web server · Serves dashboard APIs and scan control endpoints.
internal/web/server.go - Scan orchestrator · Owns scan lifecycle, recovery, and control actions.
internal/web/orchestrator.go - Scan scheduler
internal/web/scheduler.go - Durable scan records · Persists scan state for recovery.
internal/web/scan_record.go - Per-scan context · Holds findings, notes, browser, and terminal state.
internal/scanctx/context.go - WebSocket hub
internal/web/ws_hub.go - React dashboard · Visualizes scans and controls the backend.
webui/src/main.tsx
Agent execution
- LLM agent loop · Runs iterative reasoning and tool use.
internal/agent/agent.go - Planning & methodology · Builds plans and applies phase/domain guidance.
internal/agent/planner.go - Independent verifier · Re-exploits candidate vulnerabilities before confirmation.
internal/agent/verifier.go
Tooling & safety
- Tool registry · Central registry for agent-accessible tools.
internal/tools/registry.go - Terminal execution
internal/tools/terminal/terminal.go - Browser automation · Browser control and WebSocket bridge.
internal/tools/browser/browser.go - Scope guard · Enforces authorized target restrictions.
internal/scopeguard/scopeguard.go - Sandbox policy · Constrains commands and filesystem access.
internal/sandbox/policy.go - Outbound rate limit
internal/ratelimit/ratelimit.go
Providers & outputs
- LLM provider router · Routes native and OpenAI-compatible LLM requests.
internal/llm/router.go - Report generator · Produces evidence-backed reports from confirmed findings.
internal/reporting/generate.go
Connections 21
- Go CLI entry → Web server: starts local server
- Scanning container → Go CLI entry: runs
- React dashboard → Web server: REST and WebSocket
- Web server → Scan orchestrator: scan commands
- Web server → WebSocket hub: publishes live events
- WebSocket hub → React dashboard: scan updates
- Scan orchestrator → Scan scheduler: admission and scheduling
- Scan orchestrator → Durable scan records: persist and recover
- Scan orchestrator → Per-scan context: creates scan state
- Scan scheduler → LLM agent loop: launches scan
- LLM agent loop → Planning & methodology: plans methodology
- LLM agent loop → LLM provider router: LLM requests
- LLM agent loop → Tool registry: uses capabilities
- Tool registry → Terminal execution: process tools
- Tool registry → Browser automation: browser tools
- Tool registry → Scope guard: checks targets
- Tool registry → Sandbox policy: checks execution
- Tool registry → Outbound rate limit: paces outbound traffic
- LLM agent loop → Independent verifier: candidate findings
- Independent verifier → Per-scan context: confirmed findings
- Per-scan context → Report generator: evidence and findings