# filipecastanheira-rgb/hermes-lab architecture

> Architecture diagram of the GitHub repository filipecastanheira-rgb/hermes-lab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/filipecastanheira-rgb/hermes-lab
- Repository: https://github.com/filipecastanheira-rgb/hermes-lab

## Overview

Hermes-Lab is a manual-operation cybersecurity lab platform: an operator selects a tool and target in the dashboard, the service dispatches the scan or monitoring read, and the results are normalized and reported by a local LLM. The shared tool registry, lab allowlist, and raw/clean event store form the main internal layers; BLUE provides a separate passive-monitoring capability. Autonomous tool selection and chained investigations are archived or unvalidated, not part of the current workflow. Relationships for unsampled dashboard and service details rely on README documentation; source excerpts establish the shown tool, storage, and intelligence links.

Main entry points: [`hermes/tools/agregador_ferramentas.py`](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/tools/agregador_ferramentas.py) (Tool registry), [`hermes/purple/purple_api.py`](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/purple/purple_api.py) (HTTP API), [`hermes/core/event_store.py`](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/core/event_store.py) (Event store), [`hermes/purple/purple_runner.py`](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/purple/purple_runner.py) (Service runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_service["Service and interface"]
  node_dashboard["Dashboard"]
  node_api["HTTP API<br/>[purple_api.py]"]
  node_runner["Service runner<br/>[purple_runner.py]"]
  node_auth["Token auth<br/>[purple_auth.py]"]
  node_rate["Rate limiting"]
end

subgraph group_execution["Tool execution"]
  node_dispatcher["Tool dispatcher<br/>[tool_dispatcher.py]"]
  node_registry["Tool registry"]
  node_boundary["Lab allowlist<br/>[lab_boundary.py]"]
  node_nmap["Nmap scanner<br/>[nmap_reader.py]"]
  node_openvas["OpenVAS scanner<br/>[openvas_reader.py]"]
  node_tshark["TShark capture<br/>[tshark_reader.py]"]
  node_suricata["Suricata IDS<br/>[suricata_reader.py]"]
  node_zeek["Zeek monitor<br/>[zeek_reader.py]"]
end

subgraph group_events["Events and reporting"]
  node_rawclean[("Event store<br/>[event_store.py]")]
  node_context["Context builder<br/>[context_builder.py]"]
  node_intelligence["Intelligence service"]
end

subgraph group_blue["BLUE monitoring"]
  node_blue_router["BLUE router<br/>[mode_router.py]"]
  node_alert_engine["Alert engine<br/>[alert_engine.py]"]
  node_log_manager["Log manager<br/>[log_manager.py]"]
  node_dependency["Dependency manager"]
end

node_operator(("Operator"))
node_llm{{"Ollama LLM"}}

node_operator -->|"selects target"| node_dashboard
node_dashboard -->|"sends requests"| node_api
node_runner -->|"starts service"| node_api
node_api -->|"dispatches tool"| node_dispatcher
node_api -->|"requests report"| node_intelligence
node_api -->|"authenticates"| node_auth
node_api -.->|"limits requests"| node_rate
node_dispatcher -->|"checks scope"| node_boundary
node_dispatcher -->|"dispatches tool"| node_registry
node_registry -->|"registers tool"| node_nmap
node_registry -->|"registers tool"| node_openvas
node_registry -->|"registers tool"| node_tshark
node_registry -->|"registers tool"| node_suricata
node_registry -->|"registers tool"| node_zeek
node_nmap -->|"writes events"| node_rawclean
node_openvas -->|"writes events"| node_rawclean
node_tshark -->|"writes events"| node_rawclean
node_suricata -->|"writes events"| node_rawclean
node_zeek -.->|"writes events"| node_rawclean
node_context -->|"reads clean events"| node_rawclean
node_intelligence -->|"builds context"| node_context
node_intelligence -->|"generates report"| node_llm
node_runner -.->|"ensures services"| node_dependency
node_runner -.->|"starts monitoring"| node_blue_router
node_blue_router -->|"activates module"| node_alert_engine
node_blue_router -->|"activates module"| node_log_manager

click node_dashboard "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/purple/purple_dashboard.py"
click node_api "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/purple/purple_api.py"
click node_runner "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/purple/purple_runner.py"
click node_auth "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/purple/purple_auth.py"
click node_rate "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/purple/purple_ratelimit.py"
click node_dispatcher "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/core/tool_dispatcher.py"
click node_registry "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/tools/agregador_ferramentas.py"
click node_boundary "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/core/lab_boundary.py"
click node_nmap "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/tools/nmap/nmap_reader.py"
click node_openvas "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/tools/openvas/openvas_reader.py"
click node_tshark "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/tools/tshark/tshark_reader.py"
click node_suricata "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/tools/suricata/suricata_reader.py"
click node_zeek "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/tools/zeek/zeek_reader.py"
click node_rawclean "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/core/event_store.py"
click node_context "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/core/context_builder.py"
click node_intelligence "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/core/intelligence_service.py"
click node_blue_router "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/modes/mode_router.py"
click node_alert_engine "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/blue/alert_engine.py"
click node_log_manager "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/blue/log_manager.py"
click node_dependency "https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/core/dependency_manager.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard,node_api,node_runner,node_auth,node_rate toneBlue
class node_dispatcher,node_registry,node_boundary,node_nmap,node_openvas,node_tshark,node_suricata,node_zeek toneAmber
class node_rawclean,node_context,node_intelligence toneMint
class node_blue_router,node_alert_engine,node_log_manager,node_dependency toneRose
class node_operator,node_llm toneIndigo
```

## Components

### Service and interface

- [Dashboard](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/purple/purple_dashboard.py): `hermes/purple/purple_dashboard.py`
- [HTTP API](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/purple/purple_api.py): `hermes/purple/purple_api.py`
- [Service runner](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/purple/purple_runner.py): `hermes/purple/purple_runner.py`
- [Token auth](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/purple/purple_auth.py): `hermes/purple/purple_auth.py`
- [Rate limiting](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/purple/purple_ratelimit.py): `hermes/purple/purple_ratelimit.py`

### Tool execution

- [Tool dispatcher](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/core/tool_dispatcher.py): `hermes/core/tool_dispatcher.py`
- [Tool registry](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/tools/agregador_ferramentas.py): `hermes/tools/agregador_ferramentas.py`
- [Lab allowlist](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/core/lab_boundary.py): `hermes/core/lab_boundary.py`
- [Nmap scanner](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/tools/nmap/nmap_reader.py): `hermes/tools/nmap/nmap_reader.py`
- [OpenVAS scanner](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/tools/openvas/openvas_reader.py): `hermes/tools/openvas/openvas_reader.py`
- [TShark capture](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/tools/tshark/tshark_reader.py): `hermes/tools/tshark/tshark_reader.py`
- [Suricata IDS](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/tools/suricata/suricata_reader.py): `hermes/tools/suricata/suricata_reader.py`
- [Zeek monitor](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/tools/zeek/zeek_reader.py): `hermes/tools/zeek/zeek_reader.py`

### Events and reporting

- [Event store](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/core/event_store.py): `hermes/core/event_store.py`
- [Context builder](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/core/context_builder.py): `hermes/core/context_builder.py`
- [Intelligence service](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/core/intelligence_service.py): `hermes/core/intelligence_service.py`

### BLUE monitoring

- [BLUE router](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/modes/mode_router.py): `hermes/modes/mode_router.py`
- [Alert engine](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/blue/alert_engine.py): `hermes/blue/alert_engine.py`
- [Log manager](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/blue/log_manager.py): `hermes/blue/log_manager.py`
- [Dependency manager](https://github.com/filipecastanheira-rgb/hermes-lab/blob/master/hermes/core/dependency_manager.py): `hermes/core/dependency_manager.py`

### Other components

- **Operator**
- **Ollama LLM**

## Connections

- Operator → Dashboard: selects target (evidence: `README.md`)
- Dashboard → HTTP API: sends requests (evidence: `README.md`)
- Service runner → HTTP API: starts service (evidence: `hermes/purple/purple_runner.py`)
- HTTP API → Tool dispatcher: dispatches tool (evidence: `README.md`)
- HTTP API → Intelligence service: requests report (evidence: `README.md`)
- HTTP API → Token auth: authenticates (evidence: `hermes/purple/purple_api.py`)
- HTTP API → Rate limiting: limits requests
- Tool dispatcher → Lab allowlist: checks scope (evidence: `hermes/core/tool_dispatcher.py`)
- Tool dispatcher → Tool registry: dispatches tool (evidence: `hermes/core/tool_dispatcher.py`)
- Tool registry → Nmap scanner: registers tool (evidence: `hermes/tools/agregador_ferramentas.py`)
- Tool registry → OpenVAS scanner: registers tool (evidence: `hermes/tools/agregador_ferramentas.py`)
- Tool registry → TShark capture: registers tool (evidence: `hermes/tools/agregador_ferramentas.py`)
- Tool registry → Suricata IDS: registers tool (evidence: `hermes/tools/agregador_ferramentas.py`)
- Tool registry → Zeek monitor: registers tool (evidence: `hermes/tools/agregador_ferramentas.py`)
- Nmap scanner → Event store: writes events (evidence: `hermes/tools/nmap/nmap_reader.py`)
- OpenVAS scanner → Event store: writes events (evidence: `hermes/tools/openvas/openvas_reader.py`)
- TShark capture → Event store: writes events (evidence: `hermes/tools/tshark/tshark_reader.py`)
- Suricata IDS → Event store: writes events (evidence: `hermes/tools/suricata/suricata_reader.py`)
- Zeek monitor → Event store: writes events (evidence: `hermes/tools/zeek/zeek_reader.py`)
- Context builder → Event store: reads clean events (evidence: `hermes/core/context_builder.py`)
- Intelligence service → Context builder: builds context (evidence: `hermes/core/intelligence_service.py`)
- Intelligence service → Ollama LLM: generates report (evidence: `hermes/core/intelligence_service.py`)
- Service runner → Dependency manager: ensures services (evidence: `hermes/purple/purple_runner.py`)
- Service runner → BLUE router: starts monitoring (evidence: `hermes/purple/purple_runner.py`)
- BLUE router → Alert engine: activates module (evidence: `hermes/modes/mode_router.py`)
- BLUE router → Log manager: activates module (evidence: `hermes/modes/mode_router.py`)
