Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0xSteph Pentest ai Dashboard JS

From Leeroopedia
Knowledge Sources
Domains Frontend, Dashboard, Visualization
Last Updated 2026-10-23 00:00 GMT

Overview

Concrete tool for rendering a browser-based pentest engagement dashboard that polls the local FastAPI surface, provided by the pentest-ai API static assets.

Description

The dashboard.js file is a plain-vanilla JavaScript single-page dashboard with no build step. It polls the local FastAPI REST API at 4-second intervals, rendering engagements, findings (with severity filtering), attack chains, and a live event stream via WebSocket. It includes HTML escaping for all rendered content, health/version indicators, and tab navigation between engagements and findings views. Served same-origin only by the FastAPI static files mount at /dashboard.

Usage

This file is served as a static asset by the FastAPI server at /dashboard/. No import needed — it is loaded via a <script> tag in the dashboard HTML page. It automatically connects to the same-origin API.

Code Reference

Source Location

Signature

// IIFE module — no exports, attaches to DOM on load.
// State: engagements, findings, chains, health, WebSocket connection
// Poll interval: 4000ms
// API base: '' (same-origin)

const state = {
    engagements: [],
    selectedId: null,
    selectedFindings: [],
    selectedChains: [],
    selectedSummary: null,
    severityFilter: null,
    activeTab: 'engagements',
    healthOk: false,
    pollTimer: null,
    ws: null,
};

async function api(path, opts) { ... }
async function refreshHealth() { ... }
async function refreshEngagements() { ... }
async function selectEngagement(id) { ... }

Import

<!-- Loaded automatically when served by FastAPI at /dashboard/ -->
<script src="dashboard.js"></script>

I/O Contract

Inputs

Name Type Required Description
/health HTTP GET Yes Liveness check for connection status indicator
/version HTTP GET Yes Version badge display
/engagements HTTP GET Yes Engagement list polling
/engagements/{id}/findings HTTP GET Yes Findings for selected engagement
/engagements/{id}/chains HTTP GET Yes Attack chains for selected engagement
/engagements/{id}/stream WebSocket No Live event stream (findings, summary)

Outputs

Name Type Description
DOM updates HTML Rendered engagement table, findings list, chain viewer, health indicator

Usage Examples

Running the Dashboard

# Start the API server
uvicorn api.server:app --host 0.0.0.0 --port 8000

# Open the dashboard in a browser
# http://localhost:8000/dashboard/

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment