# sbyoroh/soc-cyber architecture

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

- Interactive diagram: https://gitdiagram.com/sbyoroh/soc-cyber
- Repository: https://github.com/sbyoroh/soc-cyber

## Overview

This is a small AI-assisted SOC/MDR prototype: a packet sensor aggregates network traffic and submits features to an API, which predicts threats, records alerts, and can block remote IPs through the Windows firewall. A Streamlit dashboard displays recorded incidents and manages the API whitelist. The README contains no usable feature documentation; edges below are based on shown source excerpts, and no unseen modules are assumed.

Main entry points: [`main.py`](https://github.com/sbyoroh/soc-cyber/blob/main/main.py) (Detection API), [`dashboard.py`](https://github.com/sbyoroh/soc-cyber/blob/main/dashboard.py) (SOC Dashboard), [`real_sensor.py`](https://github.com/sbyoroh/soc-cyber/blob/main/real_sensor.py) (Packet Sensor), [`train_light.py`](https://github.com/sbyoroh/soc-cyber/blob/main/train_light.py) (Light Model Training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensor["Traffic Sensing"]
  node_sensor["Packet Sensor<br/>[real_sensor.py]"]
end

subgraph group_api["Detection and Response"]
  node_api["Detection API<br/>[main.py]"]
  node_model["Lightweight XGBoost<br/>[main.py]"]
  node_firewall["Windows Firewall"]
  node_alerts[("Security Alerts<br/>[main.py]")]
  node_whitelist["Whitelist State<br/>[main.py]"]
end

subgraph group_dashboard["Operations Dashboard"]
  node_dashboard["SOC Dashboard<br/>[dashboard.py]"]
end

subgraph group_training["Model Training"]
  node_trainer["Light Model Training<br/>[train_light.py]"]
  node_dataset["UNSW-NB15 Dataset"]
  node_model_artifact["Light Model Artifact"]
end

node_network(("Network Traffic"))

node_network -->|"provides packets"| node_sensor
node_sensor -->|"posts features"| node_api
node_api -->|"predicts threats"| node_model
node_api -->|"blocks IP"| node_firewall
node_api -->|"writes alerts"| node_alerts
node_dashboard -->|"reads incidents"| node_alerts
node_dashboard -->|"manages whitelist"| node_api
node_api -->|"updates and lists"| node_whitelist
node_dataset -->|"trains from"| node_trainer
node_trainer -->|"saves model"| node_model_artifact
node_model_artifact -->|"loaded at startup"| node_model

click node_sensor "https://github.com/sbyoroh/soc-cyber/blob/main/real_sensor.py"
click node_api "https://github.com/sbyoroh/soc-cyber/blob/main/main.py"
click node_model "https://github.com/sbyoroh/soc-cyber/blob/main/main.py"
click node_alerts "https://github.com/sbyoroh/soc-cyber/blob/main/main.py"
click node_dashboard "https://github.com/sbyoroh/soc-cyber/blob/main/dashboard.py"
click node_whitelist "https://github.com/sbyoroh/soc-cyber/blob/main/main.py"
click node_trainer "https://github.com/sbyoroh/soc-cyber/blob/main/train_light.py"
click node_model_artifact "https://github.com/sbyoroh/soc-cyber/blob/main/xgb_model_light.pkl"

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_sensor toneBlue
class node_api,node_model,node_firewall,node_alerts,node_whitelist toneAmber
class node_dashboard toneMint
class node_trainer,node_dataset,node_model_artifact toneRose
class node_network toneIndigo
```

## Components

### Traffic Sensing

- [Packet Sensor](https://github.com/sbyoroh/soc-cyber/blob/main/real_sensor.py): `real_sensor.py`

### Detection and Response

- [Detection API](https://github.com/sbyoroh/soc-cyber/blob/main/main.py): `main.py`
- [Lightweight XGBoost](https://github.com/sbyoroh/soc-cyber/blob/main/main.py): `main.py`
- **Windows Firewall**
- [Security Alerts](https://github.com/sbyoroh/soc-cyber/blob/main/main.py): `main.py`
- [Whitelist State](https://github.com/sbyoroh/soc-cyber/blob/main/main.py): `main.py`

### Operations Dashboard

- [SOC Dashboard](https://github.com/sbyoroh/soc-cyber/blob/main/dashboard.py): `dashboard.py`

### Model Training

- [Light Model Training](https://github.com/sbyoroh/soc-cyber/blob/main/train_light.py): `train_light.py`
- **UNSW-NB15 Dataset**
- [Light Model Artifact](https://github.com/sbyoroh/soc-cyber/blob/main/xgb_model_light.pkl): `xgb_model_light.pkl`

### Other components

- **Network Traffic**

## Connections

- Network Traffic → Packet Sensor: provides packets (evidence: `real_sensor.py`)
- Packet Sensor → Detection API: posts features (evidence: `real_sensor.py`)
- Detection API → Lightweight XGBoost: predicts threats (evidence: `main.py`)
- Detection API → Windows Firewall: blocks IP (evidence: `main.py`)
- Detection API → Security Alerts: writes alerts (evidence: `main.py`)
- SOC Dashboard → Security Alerts: reads incidents (evidence: `dashboard.py`)
- SOC Dashboard → Detection API: manages whitelist (evidence: `dashboard.py`)
- Detection API → Whitelist State: updates and lists (evidence: `main.py`)
- UNSW-NB15 Dataset → Light Model Training: trains from (evidence: `train_light.py`)
- Light Model Training → Light Model Artifact: saves model (evidence: `train_light.py`)
- Light Model Artifact → Lightweight XGBoost: loaded at startup (evidence: `main.py`)
