# shreemanitcse8095/netsight architecture

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

- Interactive diagram: https://gitdiagram.com/shreemanitcse8095/netsight
- Repository: https://github.com/shreemanitcse8095/netsight

## Overview

NetSight classifies network traffic from live interfaces or PCAPs, streams flow telemetry to a Python collector, and presents it through a React dashboard. The principal path is packet capture/replay → DPI and flow/rule analysis → NDJSON over TCP → in-memory aggregation and SQLite history → REST/WebSocket telemetry → dashboard views. The README also documents offline PCAP analysis, dynamic rules, and security findings. Edges are limited to relationships shown in excerpts or explicit README statements; unsampled engine internals and dashboard API wiring are represented cautiously.

Main entry points: [`engine/src/engine_core.cpp`](https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/engine_core.cpp) (Engine Orchestration), [`dashboard/src/App.tsx`](https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/App.tsx) (Dashboard Shell), [`collector/main.py`](https://github.com/shreemanitcse8095/netsight/blob/main/collector/main.py) (Collector API), [`collector/tcp_ingest.py`](https://github.com/shreemanitcse8095/netsight/blob/main/collector/tcp_ingest.py) (NDJSON Ingest)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_engine["DPI Engine"]
  node_engine_entry["Engine Modes<br/>[main.cpp]"]
  node_packet_parse["Packet Parsing<br/>[packet_parser.cpp]"]
  node_pcap_reader["PCAP Reader<br/>[pcap_reader.cpp]"]
  node_live_capture["Live Capture<br/>[live_capture.cpp]"]
  node_flow_analysis["Flow Analysis"]
  node_tls_classify["TLS Classification<br/>[tls_extractor.cpp]"]
  node_dns_analysis["DNS Analysis<br/>[dns_parser.cpp]"]
  node_host_profile["Host Profiling<br/>[host_profiler.cpp]"]
  node_rule_manager["Dynamic Rules<br/>[rule_manager.cpp]"]
  node_engine_core["Engine Orchestration<br/>[engine_core.cpp]"]
  node_tcp_stream["Telemetry TCP<br/>[tcp_server.cpp]"]
end

subgraph group_collector["Telemetry Collector"]
  node_collector_api["Collector API<br/>[main.py]"]
  node_tcp_ingest["NDJSON Ingest<br/>[tcp_ingest.py]"]
  node_flow_cache[("Live Flow Cache<br/>[flow_cache.py]")]
  node_models["Telemetry Models<br/>[models.py]"]
  node_history_db[("History Storage<br/>[database.py]")]
end

subgraph group_dashboard["Dashboard"]
  node_dashboard_app["Dashboard Shell<br/>[App.tsx]"]
  node_telemetry_hook["Telemetry State"]
  node_overview["Overview<br/>[OverviewView.tsx]"]
  node_flows["Flow Explorer<br/>[FlowsView.tsx]"]
  node_history["History View<br/>[HistoryView.tsx]"]
  node_analytics["DPI Analytics<br/>[AnalyticsView.tsx]"]
  node_analyze["PCAP Analyzer<br/>[AnalyzeView.tsx]"]
  node_rules_view["Rule Controls<br/>[RulesView.tsx]"]
  node_navbar["Navigation<br/>[Navbar.tsx]"]
end

node_operator(("Network Operator"))
node_interface(("Network Interface"))
node_pcap["PCAP Input"]

node_operator -->|"selects mode"| node_engine_entry
node_interface -->|"provides packets"| node_live_capture
node_pcap -->|"provides capture"| node_pcap_reader
node_engine_entry -->|"starts"| node_engine_core
node_engine_core -.->|"captures from"| node_live_capture
node_engine_core -.->|"reads replay"| node_pcap_reader
node_engine_core -.->|"processes packets"| node_packet_parse
node_engine_core -.->|"tracks flows"| node_flow_analysis
node_engine_core -.->|"extracts TLS"| node_tls_classify
node_engine_core -.->|"parses DNS"| node_dns_analysis
node_engine_core -.->|"profiles hosts"| node_host_profile
node_engine_core -.->|"checks rules"| node_rule_manager
node_engine_core -.->|"exports telemetry"| node_tcp_stream
node_tcp_stream -->|"streams NDJSON"| node_tcp_ingest
node_collector_api -->|"starts client"| node_tcp_ingest
node_tcp_ingest -->|"updates records"| node_flow_cache
node_tcp_ingest -->|"parses records"| node_models
node_collector_api -->|"serves telemetry"| node_flow_cache
node_collector_api -->|"records rollups"| node_history_db
node_history_db -.->|"returns history"| node_collector_api
node_collector_api -->|"serves REST and WS"| node_dashboard_app
node_dashboard_app -->|"renders navigation"| node_navbar
node_dashboard_app -->|"renders overview"| node_overview
node_dashboard_app -->|"renders flows"| node_flows
node_dashboard_app -->|"renders history"| node_history
node_dashboard_app -->|"renders analytics"| node_analytics
node_dashboard_app -->|"renders analyzer"| node_analyze
node_dashboard_app -->|"renders rules"| node_rules_view
node_dashboard_app -->|"uses telemetry"| node_telemetry_hook
node_telemetry_hook -.->|"fetches and subscribes"| node_collector_api
node_analyze -.->|"uploads PCAP"| node_collector_api
node_rules_view -.->|"updates rules"| node_collector_api

click node_engine_entry "https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/main.cpp"
click node_packet_parse "https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/packet_parser.cpp"
click node_pcap_reader "https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/pcap_reader.cpp"
click node_live_capture "https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/live_capture.cpp"
click node_flow_analysis "https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/connection_tracker.cpp"
click node_tls_classify "https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/tls_extractor.cpp"
click node_dns_analysis "https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/dns_parser.cpp"
click node_host_profile "https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/host_profiler.cpp"
click node_rule_manager "https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/rule_manager.cpp"
click node_engine_core "https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/engine_core.cpp"
click node_tcp_stream "https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/tcp_server.cpp"
click node_collector_api "https://github.com/shreemanitcse8095/netsight/blob/main/collector/main.py"
click node_tcp_ingest "https://github.com/shreemanitcse8095/netsight/blob/main/collector/tcp_ingest.py"
click node_flow_cache "https://github.com/shreemanitcse8095/netsight/blob/main/collector/flow_cache.py"
click node_models "https://github.com/shreemanitcse8095/netsight/blob/main/collector/models.py"
click node_history_db "https://github.com/shreemanitcse8095/netsight/blob/main/collector/database.py"
click node_dashboard_app "https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/App.tsx"
click node_telemetry_hook "https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/hooks/useNetSightTelemetry.ts"
click node_overview "https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/components/OverviewView.tsx"
click node_flows "https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/components/FlowsView.tsx"
click node_history "https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/components/HistoryView.tsx"
click node_analytics "https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/components/AnalyticsView.tsx"
click node_analyze "https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/components/AnalyzeView.tsx"
click node_rules_view "https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/components/RulesView.tsx"
click node_navbar "https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/components/Navbar.tsx"

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_engine_entry,node_packet_parse,node_pcap_reader,node_live_capture,node_flow_analysis,node_tls_classify,node_dns_analysis,node_host_profile,node_rule_manager,node_engine_core,node_tcp_stream toneBlue
class node_collector_api,node_tcp_ingest,node_flow_cache,node_models,node_history_db toneAmber
class node_dashboard_app,node_telemetry_hook,node_overview,node_flows,node_history,node_analytics,node_analyze,node_rules_view,node_navbar toneMint
class node_operator,node_interface,node_pcap toneIndigo
```

## Components

### DPI Engine

- [Engine Modes](https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/main.cpp): `engine/src/main.cpp`
- [Packet Parsing](https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/packet_parser.cpp): `engine/src/packet_parser.cpp`
- [PCAP Reader](https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/pcap_reader.cpp): `engine/src/pcap_reader.cpp`
- [Live Capture](https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/live_capture.cpp): `engine/src/live_capture.cpp`
- [Flow Analysis](https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/connection_tracker.cpp): `engine/src/connection_tracker.cpp`
- [TLS Classification](https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/tls_extractor.cpp): `engine/src/tls_extractor.cpp`
- [DNS Analysis](https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/dns_parser.cpp): `engine/src/dns_parser.cpp`
- [Host Profiling](https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/host_profiler.cpp): `engine/src/host_profiler.cpp`
- [Dynamic Rules](https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/rule_manager.cpp): `engine/src/rule_manager.cpp`
- [Engine Orchestration](https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/engine_core.cpp): `engine/src/engine_core.cpp`
- [Telemetry TCP](https://github.com/shreemanitcse8095/netsight/blob/main/engine/src/tcp_server.cpp): `engine/src/tcp_server.cpp`

### Telemetry Collector

- [Collector API](https://github.com/shreemanitcse8095/netsight/blob/main/collector/main.py): `collector/main.py`
- [NDJSON Ingest](https://github.com/shreemanitcse8095/netsight/blob/main/collector/tcp_ingest.py): `collector/tcp_ingest.py`
- [Live Flow Cache](https://github.com/shreemanitcse8095/netsight/blob/main/collector/flow_cache.py): `collector/flow_cache.py`
- [Telemetry Models](https://github.com/shreemanitcse8095/netsight/blob/main/collector/models.py): `collector/models.py`
- [History Storage](https://github.com/shreemanitcse8095/netsight/blob/main/collector/database.py): `collector/database.py`

### Dashboard

- [Dashboard Shell](https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/App.tsx): `dashboard/src/App.tsx`
- [Telemetry State](https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/hooks/useNetSightTelemetry.ts): `dashboard/src/hooks/useNetSightTelemetry.ts`
- [Overview](https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/components/OverviewView.tsx): `dashboard/src/components/OverviewView.tsx`
- [Flow Explorer](https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/components/FlowsView.tsx): `dashboard/src/components/FlowsView.tsx`
- [History View](https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/components/HistoryView.tsx): `dashboard/src/components/HistoryView.tsx`
- [DPI Analytics](https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/components/AnalyticsView.tsx): `dashboard/src/components/AnalyticsView.tsx`
- [PCAP Analyzer](https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/components/AnalyzeView.tsx): `dashboard/src/components/AnalyzeView.tsx`
- [Rule Controls](https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/components/RulesView.tsx): `dashboard/src/components/RulesView.tsx`
- [Navigation](https://github.com/shreemanitcse8095/netsight/blob/main/dashboard/src/components/Navbar.tsx): `dashboard/src/components/Navbar.tsx`

### Other components

- **Network Operator**
- **Network Interface**
- **PCAP Input**

## Connections

- Network Operator → Engine Modes: selects mode
- Network Interface → Live Capture: provides packets
- PCAP Input → PCAP Reader: provides capture
- Engine Modes → Engine Orchestration: starts (evidence: `engine/src/main.cpp`)
- Engine Orchestration → Live Capture: captures from
- Engine Orchestration → PCAP Reader: reads replay
- Engine Orchestration → Packet Parsing: processes packets
- Engine Orchestration → Flow Analysis: tracks flows
- Engine Orchestration → TLS Classification: extracts TLS
- Engine Orchestration → DNS Analysis: parses DNS
- Engine Orchestration → Host Profiling: profiles hosts
- Engine Orchestration → Dynamic Rules: checks rules
- Engine Orchestration → Telemetry TCP: exports telemetry
- Telemetry TCP → NDJSON Ingest: streams NDJSON
- Collector API → NDJSON Ingest: starts client (evidence: `collector/main.py`)
- NDJSON Ingest → Live Flow Cache: updates records (evidence: `collector/tcp_ingest.py`)
- NDJSON Ingest → Telemetry Models: parses records (evidence: `collector/tcp_ingest.py`)
- Collector API → Live Flow Cache: serves telemetry (evidence: `collector/main.py`)
- Collector API → History Storage: records rollups (evidence: `collector/main.py`)
- History Storage → Collector API: returns history (evidence: `collector/main.py`)
- Collector API → Dashboard Shell: serves REST and WS
- Dashboard Shell → Navigation: renders navigation (evidence: `dashboard/src/App.tsx`)
- Dashboard Shell → Overview: renders overview (evidence: `dashboard/src/App.tsx`)
- Dashboard Shell → Flow Explorer: renders flows (evidence: `dashboard/src/App.tsx`)
- Dashboard Shell → History View: renders history (evidence: `dashboard/src/App.tsx`)
- Dashboard Shell → DPI Analytics: renders analytics (evidence: `dashboard/src/App.tsx`)
- Dashboard Shell → PCAP Analyzer: renders analyzer (evidence: `dashboard/src/App.tsx`)
- Dashboard Shell → Rule Controls: renders rules (evidence: `dashboard/src/App.tsx`)
- Dashboard Shell → Telemetry State: uses telemetry (evidence: `dashboard/src/App.tsx`)
- Telemetry State → Collector API: fetches and subscribes
- PCAP Analyzer → Collector API: uploads PCAP
- Rule Controls → Collector API: updates rules
