LARP is an Agent–Manager cybersecurity platform for small and medium enterprises (SMEs). It provides real‑time endpoint monitoring, behavioral risk assessment, automated incident response, and network topology management.
The system consists of three main components:
- Manager – FastAPI backend, PostgreSQL database, WebSocket server.
- Agent – lightweight Python client running on each protected machine.
- Frontend – React (Vite) dashboard for SOC operators and administrators.
- Architecture Overview
- Project Structure
- Key Features
- Screenshots
- Getting Started
- API Documentation
- Testing
- Technologies Used
Linux and Windows Agents connect to FastAPI at /ws/agent. The SOC frontend uses REST under /api/v1 and receives live updates at /ws/dashboard. Nginx serves the React build and proxies both API and WebSocket traffic.
| Layer | Main entry points and data |
|---|---|
| Endpoint | agent/agent.py collects heartbeats, process snapshots, socket and interface metrics, FIM changes, auth logs, DNS queries and supported web logs. Windows has separate Python minimal and C++ clients with platform-specific coverage. Commands run in endpoint handlers and return an outcome via COMMAND_ACK. |
| Ingestion | manager/app/websocket/agent_ws.py dispatches telemetry by message type. Manager stores inventory and samples in agents, agent_history, process_info, flows, events, auth_events and web_access_logs. |
| Detection | services/detection/risk_assessment_service.py evaluates 19 registered strategies and stores raw and smoothed scores with factors in risk_score_records. services/rule_engine.py evaluates event rules and active Sigma candidates. |
| Incident and response | incidents stores evidence and analyst labels. response_policies, response_actions, commands and action_audit_logs track response execution and available rollback. |
| AI workflows | Ollama summarizes incidents, maps MITRE techniques and proposes response actions for analyst approval. ai_analysis stores triage and confidence. Harvest and validation manage Sigma drafts through rule_candidates and rule_versions. Risk Score is generated by deterministic rules. |
See the Vietnamese user guide for the complete architecture and development conventions and the pre-change code and logic audit.
The frontend is built with React 19, Vite, and Chart.js. It provides a complete SOC dashboard with:
- Real‑time KPI cards
- Agent management (isolate, unisolate, history)
- Alerts & Incidents
- 3D Network Topology
- Risk Assessment Monitor
- Detection Rules Engine
- Threat Intelligence lookup
- Process Tree & Root Cause Analysis
- Reports, Whitelist, Notifications, Settings
larp/
├── agent/ # Lightweight Python agent
│ ├── agent.py
│ ├── commands/ # Command handlers (isolate, kill_tree, quarantine...)
│ ├── malware_sim/ # Malware simulation scripts for testing
│ ├── Dockerfile
│ └── requirements.txt
│
├── attacker/ # Optional attacker container (SYN flood tool)
│ └── scripts/syn_flood.sh
│
├── frontend/ # React frontend
│ ├── src/
│ │ ├── api/ # Axios API services
│ │ ├── components/ # Reusable UI components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── pages/ # Page components
│ │ └── ...
│ ├── Dockerfile
│ ├── package.json
│ └── vite.config.js
│
├── manager/ # FastAPI backend
│ ├── app/
│ │ ├── core/ # Configuration, database, exceptions
│ │ ├── models/ # SQLAlchemy models
│ │ ├── schemas/ # Pydantic DTOs
│ │ ├── repositories/ # Data access
│ │ ├── services/ # Business logic & risk engine
│ │ ├── routers/ # API routes
│ │ └── websocket/ # WebSocket endpoints
│ ├── tests/ # Integration tests
│ ├── Dockerfile
│ ├── requirements.txt
│ └── ...
│
├── asset/ # Screenshots used in this README
├── docker-compose.yml
└── README.md
- Real‑time Agent Monitoring – CPU, RAM, disk, last seen, and status.
- Behavioral Risk Assessment – 19 registered strategies evaluate telemetry and return a risk score (0–100).
- Automated Response – isolate agent, kill process tree, block IP, quarantine.
- Incident Management – create, assign, contain, resolve, false‑positive, close incidents.
- Dynamic Detection Rules – enable/disable, adjust weight and base score per rule.
- Threat Intelligence – check IP, domain, hash against known malicious indicators.
- Process Tree Analysis – visualize parent‑child process hierarchy, kill process tree.
- 3D Network Topology – Dijkstra‑based path finding with bandwidth constraints.
- Notifications – Discord/Telegram webhook alerts.
- Reports – generate PDF security reports.
- Whitelist – exclude trusted processes/paths from automatic isolation.
- Settings – configure risk thresholds, file change thresholds, auto‑response.
The built-in Rule Engine reports Linux shells with a remote TCP socket attached to their standard streams, temporary-directory executables with established TCP connections, and hash transitions on sensitive system files. An updated Linux Agent supplies the socket evidence and expanded FIM coverage. The weighted brute_force strategy correlates authentication logs within each service, source IP, and account. Incidents carry the rule evidence into AI triage.
See the rule criteria, scores and collection requirements.
The main dashboard provides a real‑time overview: KPI cards, network traffic chart, agent list, and recent alerts.
View and manage all connected agents. Search, filter, isolate or release agents.
Detailed information about a single agent, including CPU, RAM, disk, firewall status.
Historical CPU and RAM usage charts for an agent.
List of security alerts with severity and search/filter capabilities.
Full incident lifecycle management: assign, contain, resolve, false positive, close.
Interactive 3D graph of the network. Find shortest path with bandwidth requirements.
Monitor risk scores for all agents. View historical risk trends and triggered factors.
Manage behavioral detection strategies. Enable/disable, adjust weight and base score.
Visualize process hierarchy, identify suspicious processes, and kill process trees.
Look up IP, domain, or hash reputation.
Configure notification channels (Discord, Slack, Telegram) and view audit logs.
Generate and download PDF security reports.
Add trusted processes or paths to avoid false‑positive isolations.
Adjust risk escalation thresholds, file change thresholds, and automation settings.
- Docker & Docker Compose
- Node.js 20+ (for frontend development)
- Python 3.12 (for backend development)
Start the local services from the repository root.
docker compose up --build db manager ollama frontendOpen the UI at http://localhost:5173 and Swagger at http://localhost:8005/docs. PostgreSQL is exposed on port 5432. Start the cloudflared service separately when a tunnel token is configured. Install and point each endpoint Agent at the Manager's /ws/agent URL. The default Compose file leaves the sample Agent service commented out. AI jobs require the Ollama model named by AI_MODEL to be loaded.
Seed graduated containment policies (Block IP, Isolate Host, Isolate Group):
make seed-policies
# Or directly:
docker exec -i larp-db-1 psql -U larp -d larpdb < manager/scripts/seed_policies.sqlVerify with:
curl -s http://localhost:8005/api/v1/policies/The backend exposes a comprehensive REST API under /api/v1. Main endpoint groups:
Group Endpoints
Agents /agents, /agents/{id}, /agents/{id}/isolate, /agents/{id}/unisolate, /agents/{id}/history
Incidents /incidents, /incidents/{id}, /incidents/{id}/assign, /incidents/{id}/contain, /incidents/{id}/resolve
Risk Assessment /risk/evaluate, /risk/{agent_id}/history
Detection Rules /rules/detection, /rules/detection/{rule_id}
Topology /topology/links, /topology/update, /path/request, /path/release
Process /process/{agent_id}/tree, /process/{agent_id}/suspicious, /process/{agent_id}/kill
Threat Intel /threat-intel/check
Notifications /notifications/configs, /notifications/logs, /notifications/webhook/discord
Reports /reports, /reports/generate, /reports/{report_id}/download
Whitelist /whitelist, /whitelist/{entry_id}
Settings /settings, /settings/risk_thresholds, /settings/file_changes_thresholds
Full OpenAPI specification is available at /docs or /openapi.json.
Backend tests are written with pytest and can be run from the manager/ directory:
cd manager
python -m pytestThe test suite includes unit tests for services, integration tests for API endpoints, and WebSocket tests.
Backend: Python 3.12, FastAPI, SQLAlchemy 2.0, Pydantic v2, asyncpg, Uvicorn, WebSockets
Frontend: React 19, Vite, Chart.js, React Router, Axios, react‑force‑graph‑3d
Database: PostgreSQL 16
Containerization: Docker, Docker Compose
Testing: pytest, pytest‑asyncio, httpx














