# cerebelici/siem_home architecture

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

- Interactive diagram: https://gitdiagram.com/cerebelici/siem_home
- Repository: https://github.com/cerebelici/siem_home

## Overview

Cerberus discovers hosts, persists an inventory, audits services and CVEs, and exposes findings and scan controls over HTTP. Its scheduler owns periodic and manual work; discovery also signals newly found hosts for immediate auditing. The graph includes inventory history/timeline and JSON export as documented capabilities. Source excerpts establish most calls; README statements support documented export, periodic behavior, and reactive scheduling where implementation details are not fully shown.

Main entry points: [`internal/scheduler/scheduler.go`](https://github.com/cerebelici/siem_home/blob/main/internal/scheduler/scheduler.go) (Scan scheduler), [`internal/scanner/executor.go`](https://github.com/cerebelici/siem_home/blob/main/internal/scanner/executor.go) (Nmap scan executor), [`internal/storage/storage.go`](https://github.com/cerebelici/siem_home/blob/main/internal/storage/storage.go) (SQLite inventory store), [`cmd/sentinel/main.go`](https://github.com/cerebelici/siem_home/blob/main/cmd/sentinel/main.go) (Application startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime coordination"]
  node_main["Application startup<br/>[main.go]"]
  node_config["Runtime configuration<br/>[config.go]"]
  node_scheduler["Scan scheduler<br/>[scheduler.go]"]
end

subgraph group_discovery["Host discovery"]
  node_discovery["Host discovery service<br/>[service.go]"]
end

subgraph group_audit["Vulnerability auditing"]
  node_scanner["Nmap scan executor<br/>[executor.go]"]
  node_parser["Nmap result parser<br/>[parser.go]"]
end

subgraph group_persistence["Inventory and history"]
  node_models["Inventory data models<br/>[models.go]"]
  node_storage[("SQLite inventory store<br/>[storage.go]")]
  node_seed["Mock inventory seeding<br/>[seed.go]"]
end

subgraph group_interface["HTTP interface"]
  node_api["REST API server<br/>[server.go]"]
  node_handlers["API handlers<br/>[handlers.go]"]
  node_json["JSON inventory export<br/>[storage.go]"]
end

node_operator(("Operator or dashboard"))
node_nmap["Nmap and vuln scripts"]

node_main -->|"loads"| node_config
node_main -->|"initializes"| node_storage
node_main -->|"creates"| node_scanner
node_main -->|"starts"| node_scheduler
node_main -->|"starts"| node_api
node_scheduler -->|"runs scans"| node_discovery
node_discovery -->|"runs discovery"| node_scanner
node_discovery -->|"records hosts"| node_storage
node_discovery -->|"queues new hosts"| node_scheduler
node_scheduler -->|"runs audits"| node_scanner
node_scanner -->|"executes scans"| node_nmap
node_nmap -->|"returns XML"| node_scanner
node_scanner -->|"parses XML"| node_parser
node_parser -->|"produces results"| node_models
node_scheduler -->|"records audit results"| node_storage
node_storage -->|"stores and returns"| node_models
node_seed -->|"seeds records"| node_storage
node_api -->|"routes requests"| node_handlers
node_handlers -->|"reads inventory"| node_storage
node_handlers -->|"triggers scans"| node_scheduler
node_handlers -->|"exports snapshot"| node_json
node_operator -->|"sends requests"| node_api

click node_main "https://github.com/cerebelici/siem_home/blob/main/cmd/sentinel/main.go"
click node_config "https://github.com/cerebelici/siem_home/blob/main/internal/config/config.go"
click node_scheduler "https://github.com/cerebelici/siem_home/blob/main/internal/scheduler/scheduler.go"
click node_discovery "https://github.com/cerebelici/siem_home/blob/main/internal/discovery/service.go"
click node_scanner "https://github.com/cerebelici/siem_home/blob/main/internal/scanner/executor.go"
click node_parser "https://github.com/cerebelici/siem_home/blob/main/internal/scanner/parser.go"
click node_models "https://github.com/cerebelici/siem_home/blob/main/internal/model/models.go"
click node_storage "https://github.com/cerebelici/siem_home/blob/main/internal/storage/storage.go"
click node_seed "https://github.com/cerebelici/siem_home/blob/main/internal/storage/seed.go"
click node_api "https://github.com/cerebelici/siem_home/blob/main/internal/api/server.go"
click node_handlers "https://github.com/cerebelici/siem_home/blob/main/internal/api/handlers.go"
click node_json "https://github.com/cerebelici/siem_home/blob/main/internal/storage/storage.go"

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_main,node_config,node_scheduler toneBlue
class node_discovery toneAmber
class node_scanner,node_parser toneMint
class node_models,node_storage,node_seed toneRose
class node_api,node_handlers,node_json,node_operator,node_nmap toneIndigo
```

## Components

### Runtime coordination

- [Application startup](https://github.com/cerebelici/siem_home/blob/main/cmd/sentinel/main.go): `cmd/sentinel/main.go`
- [Runtime configuration](https://github.com/cerebelici/siem_home/blob/main/internal/config/config.go): `internal/config/config.go`
- [Scan scheduler](https://github.com/cerebelici/siem_home/blob/main/internal/scheduler/scheduler.go): `internal/scheduler/scheduler.go`

### Host discovery

- [Host discovery service](https://github.com/cerebelici/siem_home/blob/main/internal/discovery/service.go): `internal/discovery/service.go`

### Vulnerability auditing

- [Nmap scan executor](https://github.com/cerebelici/siem_home/blob/main/internal/scanner/executor.go): `internal/scanner/executor.go`
- [Nmap result parser](https://github.com/cerebelici/siem_home/blob/main/internal/scanner/parser.go): `internal/scanner/parser.go`

### Inventory and history

- [Inventory data models](https://github.com/cerebelici/siem_home/blob/main/internal/model/models.go): `internal/model/models.go`
- [SQLite inventory store](https://github.com/cerebelici/siem_home/blob/main/internal/storage/storage.go): `internal/storage/storage.go`
- [Mock inventory seeding](https://github.com/cerebelici/siem_home/blob/main/internal/storage/seed.go): `internal/storage/seed.go`

### HTTP interface

- [REST API server](https://github.com/cerebelici/siem_home/blob/main/internal/api/server.go): `internal/api/server.go`
- [API handlers](https://github.com/cerebelici/siem_home/blob/main/internal/api/handlers.go): `internal/api/handlers.go`
- [JSON inventory export](https://github.com/cerebelici/siem_home/blob/main/internal/storage/storage.go): `internal/storage/storage.go`

### Other components

- **Operator or dashboard**
- **Nmap and vuln scripts**

## Connections

- Application startup → Runtime configuration: loads (evidence: `cmd/sentinel/main.go`)
- Application startup → SQLite inventory store: initializes (evidence: `cmd/sentinel/main.go`)
- Application startup → Nmap scan executor: creates (evidence: `cmd/sentinel/main.go`)
- Application startup → Scan scheduler: starts (evidence: `cmd/sentinel/main.go`)
- Application startup → REST API server: starts (evidence: `cmd/sentinel/main.go`)
- Scan scheduler → Host discovery service: runs scans (evidence: `internal/scheduler/scheduler.go`)
- Host discovery service → Nmap scan executor: runs discovery (evidence: `internal/discovery/service.go`)
- Host discovery service → SQLite inventory store: records hosts (evidence: `internal/discovery/service.go`)
- Host discovery service → Scan scheduler: queues new hosts (evidence: `internal/scheduler/scheduler.go`)
- Scan scheduler → Nmap scan executor: runs audits (evidence: `internal/scheduler/scheduler.go`)
- Nmap scan executor → Nmap and vuln scripts: executes scans (evidence: `internal/scanner/executor.go`)
- Nmap and vuln scripts → Nmap scan executor: returns XML (evidence: `internal/scanner/executor.go`)
- Nmap scan executor → Nmap result parser: parses XML (evidence: `internal/scanner/executor.go`)
- Nmap result parser → Inventory data models: produces results (evidence: `internal/scanner/parser.go`)
- Scan scheduler → SQLite inventory store: records audit results (evidence: `internal/scheduler/scheduler.go`)
- SQLite inventory store → Inventory data models: stores and returns (evidence: `internal/storage/storage.go`)
- Mock inventory seeding → SQLite inventory store: seeds records (evidence: `internal/storage/seed.go`)
- REST API server → API handlers: routes requests (evidence: `internal/api/server.go`)
- API handlers → SQLite inventory store: reads inventory (evidence: `internal/api/handlers.go`)
- API handlers → Scan scheduler: triggers scans (evidence: `internal/api/handlers.go`)
- API handlers → JSON inventory export: exports snapshot (evidence: `README.md`)
- Operator or dashboard → REST API server: sends requests (evidence: `README.md`)
