How kiran797979/cyber-res works
Purpose and entry points
Cyber Resilience Platform is a browser-based SOC workbench that turns security events into live monitoring, attack correlation, response guidance, CVE priority, and executive resilience posture. The backend starts at backend/main.py as a FastAPI API/WebSocket service; the dashboard starts at frontend/src/main.jsx and is orchestrated by frontend/src/App.jsx. Container deployment is defined in Dockerfile.
API orchestration and contracts
backend/main.py owns REST endpoints under /api/*, CORS, rate limiting for AI routes, initial demo data setup, and the /ws/logs live stream. Pydantic response/request contracts centralize backend boundaries in backend/models.py. The frontend uses a single HTTP/WebSocket boundary in frontend/src/api/client.js, keeping panels decoupled from transport details.
Event ingestion, state, and live delivery
Demo SIEM events are produced by backend/log_generator.py; current events drive logs, stats, map origins, mappings, incidents, scoring, and analysis. backend/live_stream.py broadcasts newly generated events to connected WebSocket clients. frontend/src/App.jsx combines initial REST hydration with pushed updates, while frontend/src/components/LogTable.jsx and frontend/src/components/StatsCharts.jsx render the operational event view.
Resilience and campaign correlation
backend/resilience.py is the primary decision layer: it computes the explainable 0–100 resilience score from incident load, containment, reporting exposure, and attack surface; it also correlates events into ordered kill-chain campaigns. Results feed executive and analyst-facing panels in frontend/src/components/ResiliencePanel.jsx and frontend/src/components/ThreatSummary.jsx.
Security enrichment and response workflow
Event classification is enriched through MITRE mapping, IP intelligence, incident derivation, and CVE risk ranking:
• backend/attack_mapper.py maps event types to ATT&CK techniques, optionally loading a local STIX bundle.
• backend/ip_intel.py resolves attacker geo/reputation for map origins and per-IP details.
• backend/incident_responder.py creates incidents, playbook progression, CERT-In reporting context, and tamper-evident audit records.
• backend/cve_prioritiser.py ranks curated or NVD-sourced CVEs using exploitability, KEV, and India-sector relevance.
UI boundaries are frontend/src/components/AttackPanel.jsx, frontend/src/components/IncidentTimeline.jsx, frontend/src/components/CveQueue.jsx, and frontend/src/components/WorldMap.jsx.
AI and ML analysis paths
backend/openrouter_analyzer.py provides threat narratives and prioritization. It calls OpenRouter when configured, otherwise uses deterministic rules; rate limiting and fallback preserve dashboard availability. backend/nsl_model.py serves intrusion detections from CSV replay by default or an optional trained model artifact. Training is offline in model/train_and_validate.py, using NSL-KDD data and writing backend/intrusion_model.pkl; frontend/src/components/IntrusionPanel.jsx renders detections and accuracy.
Runtimes, deployment, and external boundaries
Runtime stack is Python 3.11+/FastAPI and Node 18+/React 18/Vite. The backend is independently deployable in Docker (Dockerfile); the Vite frontend builds to static assets. Optional external services are OpenRouter, NVD 2.0, AbuseIPDB, GreyNoise, IPinfo, ip-api.com, MITRE ATT&CK STIX, and Leaflet/OpenStreetMap. Environment-controlled integration boundaries are documented by backend/.env.example and frontend/.env.example; all core flows retain offline/demo fallbacks.
Main entry points: main.py FastAPI API + WebSocket · App.jsx Dashboard orchestration · client.js HTTP + WebSocket client · log_generator.py Demo SIEM events
Components 22
FastAPI backend
API orchestration, enrichment, and decision services.
- FastAPI API + WebSocket · Owns REST, live stream endpoint, demo setup, and AI rate limits.
backend/main.py - API contracts · Central request and response boundary.
backend/models.py - Demo SIEM events · Produces current security events.
backend/log_generator.py - Live event broadcaster · Broadcasts newly generated events to connected clients.
backend/live_stream.py - Resilience + campaign engine · Scores posture and correlates ordered kill-chain campaigns.
backend/resilience.py - MITRE mapper · Maps event types to ATT&CK techniques.
backend/attack_mapper.py - IP intelligence · Resolves attacker geography and reputation.
backend/ip_intel.py - Incident response · Derives incidents, playbooks, reporting context, and audit records.
backend/incident_responder.py - CVE prioritiser · Ranks CVEs by exploitability, KEV, and sector relevance.
backend/cve_prioritiser.py - Threat narrative analyzer · Uses OpenRouter or deterministic fallback rules.
backend/openrouter_analyzer.py - Intrusion detector · Uses CSV replay or an optional trained model.
backend/nsl_model.py - Offline model training · Trains the optional intrusion model.
model/train_and_validate.py
React dashboard
Browser workbench and decoupled API client.
- Dashboard orchestration · Hydrates via REST and merges pushed event updates.
frontend/src/App.jsx - HTTP + WebSocket client · Keeps dashboard panels decoupled from transport.
frontend/src/api/client.js - Operational event view · Logs and statistics charts.
frontend/src/components/LogTable.jsx - Resilience + threat view · Executive posture and campaign summaries.
frontend/src/components/ResiliencePanel.jsx - Enrichment + response views · Attack, incident, CVE, and world-map interfaces.
frontend/src/components/AttackPanel.jsx - Intrusion panel · Shows detections and accuracy.
frontend/src/components/IntrusionPanel.jsx
Optional integrations
Environment-configured services with offline fallbacks.
- OpenRouter
- Security intelligence feeds · NVD, IP reputation, geo, and MITRE STIX sources.
- OpenStreetMap tiles · Leaflet map data source.
Other components
- Docker deployment · Independently deploys the backend.
Dockerfile
Connections 24
- Docker deployment → FastAPI API + WebSocket: deploys
- FastAPI API + WebSocket → API contracts: validates
- Demo SIEM events → FastAPI API + WebSocket: current events
- Demo SIEM events → Live event broadcaster: new events
- Live event broadcaster → HTTP + WebSocket client: /ws/logs
- HTTP + WebSocket client → FastAPI API + WebSocket: /api/*
- HTTP + WebSocket client → Dashboard orchestration: data + updates
- Dashboard orchestration → Operational event view: renders
- Dashboard orchestration → Resilience + threat view: renders
- Dashboard orchestration → Enrichment + response views: renders
- Dashboard orchestration → Intrusion panel: renders
- FastAPI API + WebSocket → Resilience + campaign engine: scores and correlates events
- FastAPI API + WebSocket → MITRE mapper: enriches events
- FastAPI API + WebSocket → IP intelligence: enriches origins
- FastAPI API + WebSocket → Incident response: derives incidents
- FastAPI API + WebSocket → CVE prioritiser: prioritizes CVEs
- FastAPI API + WebSocket → Threat narrative analyzer: requests analysis
- FastAPI API + WebSocket → Intrusion detector: serves detections
- Offline model training → Intrusion detector: produces optional model
- Threat narrative analyzer → OpenRouter: when configured
- MITRE mapper → Security intelligence feeds: optional STIX
- IP intelligence → Security intelligence feeds: optional reputation + geo
- CVE prioritiser → Security intelligence feeds: optional NVD
- Enrichment + response views → OpenStreetMap tiles: map tiles