# mohamedaminesaadd/fog_cybersecurity_system architecture

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

- Interactive diagram: https://gitdiagram.com/mohamedaminesaadd/fog_cybersecurity_system
- Repository: https://github.com/mohamedaminesaadd/fog_cybersecurity_system

## Overview

FogShield is a decentralized security-monitoring agent: each fog node collects Suricata and Zeek logs, normalizes and stores events locally, detects alerts, and exchanges alerts and votes with peers. The Angular dashboard monitors nodes through read-only APIs; the legacy Streamlit dashboard is deprecated. The graph preserves the documented pipeline and dashboard capabilities. Some implementation links are supported only by the README or source index; unsampled internals are not inferred beyond those links.

Main entry points: [`fog_agent/node.py`](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/node.py) (Node orchestration), [`fog_agent/voting/voting_engine.py`](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/voting/voting_engine.py) (Voting rounds and tally), [`fog_agent/storage`](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/tree/main/fog_agent/storage) (Event, alert and vote repositories), [`fog_agent/normalization/event_normalizer.py`](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/normalization/event_normalizer.py) (Event normalization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent["Node agent"]
  node_entry["Agent entrypoint<br/>[main.py]"]
  node_orchestrator["Node orchestration<br/>[node.py]"]
  node_settings["Node configuration<br/>[settings.py]"]
  node_detection["Local detection rules<br/>[rules.py]"]
  node_detectengine["Detection engine<br/>[local_detector.py]"]
end

subgraph group_data["Event and state"]
  node_suricata["Suricata collector"]
  node_zeek["Zeek collector<br/>[zeek_collector.py]"]
  node_tailing["Incremental log tailing<br/>[base.py]"]
  node_normalizer["Event normalization"]
  node_eventmodel["Security events<br/>[events.py]"]
  node_alertmodel["Alert model<br/>[alerts.py]"]
  node_database[("Local SQLite database<br/>[database.py]")]
  node_repositories["Event, alert and vote repositories"]
end

subgraph group_mesh["Peer collaboration"]
  node_api["Node HTTP API<br/>[api.py]"]
  node_peerclient["Peer client<br/>[peer_client.py]"]
  node_voting["Voting rounds and tally<br/>[voting_engine.py]"]
  node_evidence["Vote evidence evaluation<br/>[evidence.py]"]
  node_votemodel["Vote and round models<br/>[votes.py]"]
  node_peer(("Fog peer nodes"))
end

subgraph group_web["Monitoring dashboards"]
  node_angular["Angular monitoring dashboard"]
  node_discovery["Node discovery"]
  node_monitoring["Monitoring service"]
  node_nodeapi["Dashboard node API client"]
  node_features["Dashboard views"]
  node_streamlit["Legacy Streamlit dashboard<br/>[app.py]"]
  node_legacyclient["Streamlit API client<br/>[api_client.py]"]
  node_dataservice["Dashboard data shaping<br/>[data_service.py]"]
end

node_operator(("Operator"))
node_dashboarduser(("Dashboard user"))

node_operator -->|"starts agent"| node_entry
node_entry -->|"runs node"| node_orchestrator
node_orchestrator -->|"uses configuration"| node_settings
node_orchestrator -->|"runs collector"| node_suricata
node_orchestrator -->|"runs collector"| node_zeek
node_suricata -->|"tails logs"| node_tailing
node_zeek -->|"tails logs"| node_tailing
node_orchestrator -->|"normalizes records"| node_normalizer
node_suricata -->|"supplies records"| node_normalizer
node_zeek -->|"supplies records"| node_normalizer
node_normalizer -->|"produces events"| node_eventmodel
node_orchestrator -->|"runs detection"| node_detectengine
node_detectengine -->|"applies rules"| node_detection
node_detectengine -->|"produces alerts"| node_alertmodel
node_orchestrator -->|"stores events"| node_repositories
node_repositories -->|"reads and writes"| node_database
node_repositories -->|"persists events"| node_eventmodel
node_repositories -->|"persists alerts"| node_alertmodel
node_orchestrator -->|"serves status"| node_api
node_orchestrator -->|"delivers alerts"| node_peerclient
node_peerclient -->|"sends messages"| node_peer
node_peer -->|"sends alerts and votes"| node_api
node_orchestrator -->|"runs voting"| node_voting
node_voting -->|"broadcasts rounds"| node_peerclient
node_voting -->|"evaluates evidence"| node_evidence
node_voting -->|"uses vote models"| node_votemodel
node_voting -->|"stores votes"| node_repositories
node_dashboarduser -->|"views monitoring"| node_angular
node_angular -->|"discovers nodes"| node_discovery
node_angular -->|"routes views"| node_features
node_features -.->|"requests monitoring"| node_monitoring
node_monitoring -->|"queries nodes"| node_nodeapi
node_discovery -->|"provides node list"| node_nodeapi
node_nodeapi -->|"queries read-only"| node_api
node_dashboarduser -->|"views legacy dashboard"| node_streamlit
node_streamlit -->|"queries nodes"| node_legacyclient
node_streamlit -->|"shapes results"| node_dataservice
node_legacyclient -->|"sends GET requests"| node_api
node_dataservice -->|"processes responses"| node_legacyclient

click node_entry "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/main.py"
click node_orchestrator "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/node.py"
click node_settings "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/config/settings.py"
click node_suricata "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/collectors/suricata_collector.py"
click node_zeek "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/collectors/zeek_collector.py"
click node_tailing "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/collectors/base.py"
click node_normalizer "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/normalization/event_normalizer.py"
click node_eventmodel "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/models/events.py"
click node_detection "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/detection/rules.py"
click node_detectengine "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/detection/local_detector.py"
click node_alertmodel "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/models/alerts.py"
click node_database "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/storage/database.py"
click node_repositories "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/tree/main/fog_agent/storage"
click node_api "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/communication/api.py"
click node_peerclient "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/communication/peer_client.py"
click node_voting "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/voting/voting_engine.py"
click node_evidence "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/voting/evidence.py"
click node_votemodel "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/models/votes.py"
click node_angular "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/tree/main/frontend/src/app"
click node_discovery "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/frontend/src/app/core/services/node-discovery.service.ts"
click node_monitoring "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/frontend/src/app/core/services/monitoring.service.ts"
click node_nodeapi "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/frontend/src/app/core/services/node-api.service.ts"
click node_features "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/tree/main/frontend/src/app/features"
click node_streamlit "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/dashboard/app.py"
click node_legacyclient "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/dashboard/api_client.py"
click node_dataservice "https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/dashboard/data_service.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_entry,node_orchestrator,node_settings,node_detection,node_detectengine,node_dashboarduser toneBlue
class node_suricata,node_zeek,node_tailing,node_normalizer,node_eventmodel,node_alertmodel,node_database,node_repositories toneAmber
class node_api,node_peerclient,node_voting,node_evidence,node_votemodel,node_peer toneMint
class node_angular,node_discovery,node_monitoring,node_nodeapi,node_features,node_streamlit,node_legacyclient,node_dataservice toneRose
class node_operator toneIndigo
```

## Components

### Node agent

- [Agent entrypoint](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/main.py): `fog_agent/main.py`
- [Node orchestration](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/node.py): `fog_agent/node.py`
- [Node configuration](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/config/settings.py): `fog_agent/config/settings.py`
- [Local detection rules](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/detection/rules.py): `fog_agent/detection/rules.py`
- [Detection engine](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/detection/local_detector.py): `fog_agent/detection/local_detector.py`

### Event and state

- [Suricata collector](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/collectors/suricata_collector.py): `fog_agent/collectors/suricata_collector.py`
- [Zeek collector](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/collectors/zeek_collector.py): `fog_agent/collectors/zeek_collector.py`
- [Incremental log tailing](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/collectors/base.py): `fog_agent/collectors/base.py`
- [Event normalization](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/normalization/event_normalizer.py): `fog_agent/normalization/event_normalizer.py`
- [Security events](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/models/events.py): `fog_agent/models/events.py`
- [Alert model](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/models/alerts.py): `fog_agent/models/alerts.py`
- [Local SQLite database](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/storage/database.py): `fog_agent/storage/database.py`
- [Event, alert and vote repositories](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/tree/main/fog_agent/storage): `fog_agent/storage`

### Peer collaboration

- [Node HTTP API](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/communication/api.py): `fog_agent/communication/api.py`
- [Peer client](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/communication/peer_client.py): `fog_agent/communication/peer_client.py`
- [Voting rounds and tally](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/voting/voting_engine.py): `fog_agent/voting/voting_engine.py`
- [Vote evidence evaluation](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/voting/evidence.py): `fog_agent/voting/evidence.py`
- [Vote and round models](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/models/votes.py): `fog_agent/models/votes.py`
- **Fog peer nodes**

### Monitoring dashboards

- [Angular monitoring dashboard](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/tree/main/frontend/src/app): `frontend/src/app`
- [Node discovery](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/frontend/src/app/core/services/node-discovery.service.ts): `frontend/src/app/core/services/node-discovery.service.ts`
- [Monitoring service](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/frontend/src/app/core/services/monitoring.service.ts): `frontend/src/app/core/services/monitoring.service.ts`
- [Dashboard node API client](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/frontend/src/app/core/services/node-api.service.ts): `frontend/src/app/core/services/node-api.service.ts`
- [Dashboard views](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/tree/main/frontend/src/app/features): `frontend/src/app/features`
- [Legacy Streamlit dashboard](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/dashboard/app.py): `fog_agent/dashboard/app.py`
- [Streamlit API client](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/dashboard/api_client.py): `fog_agent/dashboard/api_client.py`
- [Dashboard data shaping](https://github.com/mohamedaminesaadd/fog_cybersecurity_system/blob/main/fog_agent/dashboard/data_service.py): `fog_agent/dashboard/data_service.py`

### Other components

- **Operator**
- **Dashboard user**

## Connections

- Operator → Agent entrypoint: starts agent (evidence: `README.md`)
- Agent entrypoint → Node orchestration: runs node (evidence: `fog_agent/main.py`)
- Node orchestration → Node configuration: uses configuration (evidence: `README.md`)
- Node orchestration → Suricata collector: runs collector (evidence: `README.md`)
- Node orchestration → Zeek collector: runs collector (evidence: `README.md`)
- Suricata collector → Incremental log tailing: tails logs (evidence: `fog_agent/collectors/suricata_collector.py`)
- Zeek collector → Incremental log tailing: tails logs (evidence: `fog_agent/collectors/zeek_collector.py`)
- Node orchestration → Event normalization: normalizes records (evidence: `README.md`)
- Suricata collector → Event normalization: supplies records (evidence: `README.md`)
- Zeek collector → Event normalization: supplies records (evidence: `README.md`)
- Event normalization → Security events: produces events (evidence: `fog_agent/normalization/event_normalizer.py`)
- Node orchestration → Detection engine: runs detection (evidence: `README.md`)
- Detection engine → Local detection rules: applies rules
- Detection engine → Alert model: produces alerts (evidence: `README.md`)
- Node orchestration → Event, alert and vote repositories: stores events (evidence: `README.md`)
- Event, alert and vote repositories → Local SQLite database: reads and writes (evidence: `fog_agent/storage/alert_repository.py`)
- Event, alert and vote repositories → Security events: persists events (evidence: `fog_agent/storage/event_repository.py`)
- Event, alert and vote repositories → Alert model: persists alerts (evidence: `fog_agent/storage/alert_repository.py`)
- Node orchestration → Node HTTP API: serves status (evidence: `README.md`)
- Node orchestration → Peer client: delivers alerts (evidence: `README.md`)
- Peer client → Fog peer nodes: sends messages (evidence: `README.md`)
- Fog peer nodes → Node HTTP API: sends alerts and votes (evidence: `README.md`)
- Node orchestration → Voting rounds and tally: runs voting (evidence: `README.md`)
- Voting rounds and tally → Peer client: broadcasts rounds (evidence: `fog_agent/voting/voting_engine.py`)
- Voting rounds and tally → Vote evidence evaluation: evaluates evidence (evidence: `fog_agent/voting/voting_engine.py`)
- Voting rounds and tally → Vote and round models: uses vote models (evidence: `fog_agent/voting/voting_engine.py`)
- Voting rounds and tally → Event, alert and vote repositories: stores votes (evidence: `fog_agent/voting/voting_engine.py`)
- Dashboard user → Angular monitoring dashboard: views monitoring (evidence: `README.md`)
- Angular monitoring dashboard → Node discovery: discovers nodes (evidence: `frontend/src/app/app.ts`)
- Angular monitoring dashboard → Dashboard views: routes views (evidence: `frontend/src/app/app.routes.ts`)
- Dashboard views → Monitoring service: requests monitoring
- Monitoring service → Dashboard node API client: queries nodes (evidence: `frontend/src/app/core/services/monitoring.service.ts`)
- Node discovery → Dashboard node API client: provides node list (evidence: `frontend/src/app/core/services/node-api.service.ts`)
- Dashboard node API client → Node HTTP API: queries read-only (evidence: `README.md`)
- Dashboard user → Legacy Streamlit dashboard: views legacy dashboard (evidence: `README.md`)
- Legacy Streamlit dashboard → Streamlit API client: queries nodes (evidence: `fog_agent/dashboard/app.py`)
- Legacy Streamlit dashboard → Dashboard data shaping: shapes results (evidence: `fog_agent/dashboard/app.py`)
- Streamlit API client → Node HTTP API: sends GET requests (evidence: `fog_agent/dashboard/api_client.py`)
- Dashboard data shaping → Streamlit API client: processes responses (evidence: `fog_agent/dashboard/data_service.py`)
