# rakeshvankadara-netizen/network-traffic-analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/rakeshvankadara-netizen/network-traffic-analyzer
- Repository: https://github.com/rakeshvankadara-netizen/network-traffic-analyzer

## Overview

This is a small Scapy-based network traffic analyzer. Its main workflow captures IP packets, tracks protocol and endpoint/port statistics, applies security rules, writes alert and traffic logs, and presents alert counts as a dashboard chart. Detection logic is embedded in packet_capture.py rather than split into separate rule modules. README documents the port-scan and dashboard capabilities; their implementation details are only partially shown in the excerpts.

Main entry points: [`packet_capture.py`](https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/packet_capture.py) (Packet Analysis), [`dashboard.py`](https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/dashboard.py) (Alert Dashboard), [`logs/security_alerts.txt`](https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/logs/security_alerts.txt) (Alert Log), [`logs/traffic_report.txt`](https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/logs/traffic_report.txt) (Traffic Report File)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and Analysis"]
  node_scapy["Scapy Capture"]
  node_analysis["Packet Analysis<br/>[packet_capture.py]"]
  node_classification["IP and Service Classification<br/>[packet_capture.py]"]
  node_tracking["Traffic Statistics<br/>[packet_capture.py]"]
end

subgraph group_detection["Detection and Reports"]
  node_rules["Security Rules<br/>[packet_capture.py]"]
  node_alerts["Alert Log"]
  node_reporting["Traffic Report<br/>[packet_capture.py]"]
  node_report["Traffic Report File<br/>[traffic_report.txt]"]
end

subgraph group_dashboard["Dashboard"]
  node_dashboard["Alert Dashboard<br/>[dashboard.py]"]
  node_charting["Matplotlib Charting<br/>[dashboard.py]"]
  node_chart["Alert Chart"]
end

node_traffic(("Network Traffic"))
node_operator(("Operator"))

node_traffic -->|"supplies packets"| node_scapy
node_scapy -->|"dispatches packets"| node_analysis
node_analysis -->|"classifies addresses"| node_classification
node_analysis -->|"tracks traffic"| node_tracking
node_analysis -->|"checks rules"| node_rules
node_rules -->|"writes alerts"| node_alerts
node_analysis -->|"summarizes traffic"| node_reporting
node_reporting -->|"writes report"| node_report
node_operator -->|"runs"| node_dashboard
node_alerts -->|"provides log"| node_dashboard
node_dashboard -->|"plots counts"| node_charting
node_charting -->|"saves chart"| node_chart

click node_analysis "https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/packet_capture.py"
click node_classification "https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/packet_capture.py"
click node_tracking "https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/packet_capture.py"
click node_rules "https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/packet_capture.py"
click node_alerts "https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/logs/security_alerts.txt"
click node_reporting "https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/packet_capture.py"
click node_report "https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/logs/traffic_report.txt"
click node_dashboard "https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/dashboard.py"
click node_charting "https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/dashboard.py"
click node_chart "https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/tree/main/logs"

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_scapy,node_analysis,node_classification,node_tracking toneBlue
class node_rules,node_alerts,node_reporting,node_report toneAmber
class node_dashboard,node_charting,node_chart toneMint
class node_traffic,node_operator toneIndigo
```

## Components

### Capture and Analysis

- **Scapy Capture**
- [Packet Analysis](https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/packet_capture.py): `packet_capture.py`
- [IP and Service Classification](https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/packet_capture.py): `packet_capture.py`
- [Traffic Statistics](https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/packet_capture.py): `packet_capture.py`

### Detection and Reports

- [Security Rules](https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/packet_capture.py): `packet_capture.py`
- [Alert Log](https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/logs/security_alerts.txt): `logs/security_alerts.txt`
- [Traffic Report](https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/packet_capture.py): `packet_capture.py`
- [Traffic Report File](https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/logs/traffic_report.txt): `logs/traffic_report.txt`

### Dashboard

- [Alert Dashboard](https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/dashboard.py): `dashboard.py`
- [Matplotlib Charting](https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/blob/main/dashboard.py): `dashboard.py`
- [Alert Chart](https://github.com/rakeshvankadara-netizen/network-traffic-analyzer/tree/main/logs): `logs`

### Other components

- **Network Traffic**
- **Operator**

## Connections

- Network Traffic → Scapy Capture: supplies packets (evidence: `README.md`)
- Scapy Capture → Packet Analysis: dispatches packets (evidence: `packet_capture.py`)
- Packet Analysis → IP and Service Classification: classifies addresses (evidence: `packet_capture.py`)
- Packet Analysis → Traffic Statistics: tracks traffic (evidence: `packet_capture.py`)
- Packet Analysis → Security Rules: checks rules (evidence: `packet_capture.py`)
- Security Rules → Alert Log: writes alerts (evidence: `packet_capture.py`)
- Packet Analysis → Traffic Report: summarizes traffic (evidence: `packet_capture.py`)
- Traffic Report → Traffic Report File: writes report (evidence: `packet_capture.py`)
- Operator → Alert Dashboard: runs (evidence: `README.md`)
- Alert Log → Alert Dashboard: provides log (evidence: `dashboard.py`)
- Alert Dashboard → Matplotlib Charting: plots counts (evidence: `dashboard.py`)
- Matplotlib Charting → Alert Chart: saves chart (evidence: `README.md`)
