# niktab121/synshield architecture

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

- Interactive diagram: https://gitdiagram.com/niktab121/synshield
- Repository: https://github.com/niktab121/synshield

## Overview

SynShield is a network-monitoring and SYN-flood mitigation application with a Flask dashboard, local SQLite history, notifications, and an optional ARP-spoof/MITM observation mode. The intended workflow is packet capture, traffic analysis and detection, then alerting and configured mitigation; operators review events and defense actions in the dashboard. Source excerpts confirm application setup, database responsibilities, and some dashboard dependencies. Several engine modules were not sampled, so their internal relationships are shown only as unverified dashed links; README-described capabilities are retained.

Main entry points: [`src/detector.py`](https://github.com/niktab121/synshield/blob/main/src/detector.py) (Detection coordinator), [`dashboard/app.py`](https://github.com/niktab121/synshield/blob/main/dashboard/app.py) (Flask application), [`src/modules/database.py`](https://github.com/niktab121/synshield/blob/main/src/modules/database.py) (SQLite manager), [`dashboard/routes.py`](https://github.com/niktab121/synshield/blob/main/dashboard/routes.py) (Dashboard routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_engine["Detection engine"]
  node_runtime["Engine entry point<br/>[main.py]"]
  node_detector["Detection coordinator<br/>[detector.py]"]
  node_capture["Packet capture<br/>[capture.py]"]
  node_analysis["Traffic analysis<br/>[analysis.py]"]
  node_detection["Flood detection<br/>[detection.py]"]
  node_arp["ARP observation<br/>[arp_spoof.py]"]
end

subgraph group_defense["Mitigation and alerts"]
  node_mitigation["IP mitigation<br/>[mitigation.py]"]
  node_notifier["Notifications<br/>[notifier.py]"]
end

subgraph group_storage["Persistence and models"]
  node_database[("SQLite manager<br/>[database.py]")]
  node_attackmodel["Attack records<br/>[attack.py]"]
  node_alertmodel["Alert records<br/>[alert.py]"]
  node_blockedmodel["Blocked IP records<br/>[blocked_ip.py]"]
  node_constants["Runtime constants<br/>[constants.py]"]
  node_helpers["Configuration helpers<br/>[helpers.py]"]
end

subgraph group_web["Web dashboard"]
  node_dashboardapp["Flask application<br/>[app.py]"]
  node_routes["Dashboard routes<br/>[routes.py]"]
  node_api["Dashboard API<br/>[api.py]"]
  node_webclient["Dashboard client<br/>[main.js]"]
  node_api_client["API client<br/>[api-client.js]"]
  node_charts["Dashboard charts<br/>[charts.js]"]
  node_realtime["Realtime client<br/>[realtime.js]"]
end

node_operator(("Operator"))

node_operator -.->|"starts engine"| node_runtime
node_runtime -->|"starts"| node_detector
node_detector -.->|"coordinates capture"| node_capture
node_detector -.->|"analyzes traffic"| node_analysis
node_detector -.->|"checks thresholds"| node_detection
node_detector -.->|"may observe via"| node_arp
node_detector -.->|"may trigger"| node_mitigation
node_detector -.->|"may notify"| node_notifier
node_detector -.->|"records events"| node_database
node_database -->|"reads path"| node_constants
node_database -.->|"stores attacks"| node_attackmodel
node_database -.->|"stores alerts"| node_alertmodel
node_database -.->|"stores blocks"| node_blockedmodel
node_operator -->|"opens dashboard"| node_dashboardapp
node_dashboardapp -->|"loads configuration"| node_helpers
node_dashboardapp -->|"reads config path"| node_constants
node_dashboardapp -->|"initializes database"| node_database
node_dashboardapp -->|"registers routes"| node_routes
node_dashboardapp -->|"registers API"| node_api
node_routes -->|"uses defense actions"| node_mitigation
node_routes -->|"uses helpers"| node_helpers
node_routes -->|"uses constants"| node_constants
node_webclient -.->|"uses API client"| node_api_client
node_api_client -.->|"requests data"| node_api
node_webclient -.->|"renders charts"| node_charts
node_webclient -.->|"updates live"| node_realtime

click node_runtime "https://github.com/niktab121/synshield/blob/main/src/main.py"
click node_detector "https://github.com/niktab121/synshield/blob/main/src/detector.py"
click node_capture "https://github.com/niktab121/synshield/blob/main/src/modules/capture.py"
click node_analysis "https://github.com/niktab121/synshield/blob/main/src/modules/analysis.py"
click node_detection "https://github.com/niktab121/synshield/blob/main/src/modules/detection.py"
click node_arp "https://github.com/niktab121/synshield/blob/main/src/modules/arp_spoof.py"
click node_mitigation "https://github.com/niktab121/synshield/blob/main/src/modules/mitigation.py"
click node_notifier "https://github.com/niktab121/synshield/blob/main/src/modules/notifier.py"
click node_database "https://github.com/niktab121/synshield/blob/main/src/modules/database.py"
click node_attackmodel "https://github.com/niktab121/synshield/blob/main/src/models/attack.py"
click node_alertmodel "https://github.com/niktab121/synshield/blob/main/src/models/alert.py"
click node_blockedmodel "https://github.com/niktab121/synshield/blob/main/src/models/blocked_ip.py"
click node_constants "https://github.com/niktab121/synshield/blob/main/src/utils/constants.py"
click node_helpers "https://github.com/niktab121/synshield/blob/main/src/utils/helpers.py"
click node_dashboardapp "https://github.com/niktab121/synshield/blob/main/dashboard/app.py"
click node_routes "https://github.com/niktab121/synshield/blob/main/dashboard/routes.py"
click node_api "https://github.com/niktab121/synshield/blob/main/dashboard/api.py"
click node_webclient "https://github.com/niktab121/synshield/blob/main/dashboard/static/js/main.js"
click node_api_client "https://github.com/niktab121/synshield/blob/main/dashboard/static/js/api-client.js"
click node_charts "https://github.com/niktab121/synshield/blob/main/dashboard/static/js/charts.js"
click node_realtime "https://github.com/niktab121/synshield/blob/main/dashboard/static/js/realtime.js"

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_runtime,node_detector,node_capture,node_analysis,node_detection,node_arp toneBlue
class node_mitigation,node_notifier toneAmber
class node_database,node_attackmodel,node_alertmodel,node_blockedmodel,node_constants,node_helpers toneMint
class node_dashboardapp,node_routes,node_api,node_webclient,node_api_client,node_charts,node_realtime toneRose
class node_operator toneIndigo
```

## Components

### Detection engine

- [Engine entry point](https://github.com/niktab121/synshield/blob/main/src/main.py): `src/main.py`
- [Detection coordinator](https://github.com/niktab121/synshield/blob/main/src/detector.py): `src/detector.py`
- [Packet capture](https://github.com/niktab121/synshield/blob/main/src/modules/capture.py): `src/modules/capture.py`
- [Traffic analysis](https://github.com/niktab121/synshield/blob/main/src/modules/analysis.py): `src/modules/analysis.py`
- [Flood detection](https://github.com/niktab121/synshield/blob/main/src/modules/detection.py): `src/modules/detection.py`
- [ARP observation](https://github.com/niktab121/synshield/blob/main/src/modules/arp_spoof.py): `src/modules/arp_spoof.py`

### Mitigation and alerts

- [IP mitigation](https://github.com/niktab121/synshield/blob/main/src/modules/mitigation.py): `src/modules/mitigation.py`
- [Notifications](https://github.com/niktab121/synshield/blob/main/src/modules/notifier.py): `src/modules/notifier.py`

### Persistence and models

- [SQLite manager](https://github.com/niktab121/synshield/blob/main/src/modules/database.py): `src/modules/database.py`
- [Attack records](https://github.com/niktab121/synshield/blob/main/src/models/attack.py): `src/models/attack.py`
- [Alert records](https://github.com/niktab121/synshield/blob/main/src/models/alert.py): `src/models/alert.py`
- [Blocked IP records](https://github.com/niktab121/synshield/blob/main/src/models/blocked_ip.py): `src/models/blocked_ip.py`
- [Runtime constants](https://github.com/niktab121/synshield/blob/main/src/utils/constants.py): `src/utils/constants.py`
- [Configuration helpers](https://github.com/niktab121/synshield/blob/main/src/utils/helpers.py): `src/utils/helpers.py`

### Web dashboard

- [Flask application](https://github.com/niktab121/synshield/blob/main/dashboard/app.py): `dashboard/app.py`
- [Dashboard routes](https://github.com/niktab121/synshield/blob/main/dashboard/routes.py): `dashboard/routes.py`
- [Dashboard API](https://github.com/niktab121/synshield/blob/main/dashboard/api.py): `dashboard/api.py`
- [Dashboard client](https://github.com/niktab121/synshield/blob/main/dashboard/static/js/main.js): `dashboard/static/js/main.js`
- [API client](https://github.com/niktab121/synshield/blob/main/dashboard/static/js/api-client.js): `dashboard/static/js/api-client.js`
- [Dashboard charts](https://github.com/niktab121/synshield/blob/main/dashboard/static/js/charts.js): `dashboard/static/js/charts.js`
- [Realtime client](https://github.com/niktab121/synshield/blob/main/dashboard/static/js/realtime.js): `dashboard/static/js/realtime.js`

### Other components

- **Operator**

## Connections

- Operator → Engine entry point: starts engine
- Engine entry point → Detection coordinator: starts (evidence: `src/main.py`)
- Detection coordinator → Packet capture: coordinates capture
- Detection coordinator → Traffic analysis: analyzes traffic
- Detection coordinator → Flood detection: checks thresholds
- Detection coordinator → ARP observation: may observe via
- Detection coordinator → IP mitigation: may trigger
- Detection coordinator → Notifications: may notify
- Detection coordinator → SQLite manager: records events
- SQLite manager → Runtime constants: reads path (evidence: `src/modules/database.py`)
- SQLite manager → Attack records: stores attacks
- SQLite manager → Alert records: stores alerts
- SQLite manager → Blocked IP records: stores blocks
- Operator → Flask application: opens dashboard
- Flask application → Configuration helpers: loads configuration (evidence: `dashboard/app.py`)
- Flask application → Runtime constants: reads config path (evidence: `dashboard/app.py`)
- Flask application → SQLite manager: initializes database (evidence: `dashboard/app.py`)
- Flask application → Dashboard routes: registers routes (evidence: `dashboard/app.py`)
- Flask application → Dashboard API: registers API (evidence: `dashboard/app.py`)
- Dashboard routes → IP mitigation: uses defense actions (evidence: `dashboard/routes.py`)
- Dashboard routes → Configuration helpers: uses helpers (evidence: `dashboard/routes.py`)
- Dashboard routes → Runtime constants: uses constants (evidence: `dashboard/routes.py`)
- Dashboard client → API client: uses API client
- API client → Dashboard API: requests data
- Dashboard client → Dashboard charts: renders charts
- Dashboard client → Realtime client: updates live
