How vivekreddy1234/network_intrusion_detection works
This is a flow-based network intrusion detection system: the ML engine captures packets, aggregates them into flows, extracts features, classifies attack probability, and persists qualifying alerts; a separate Streamlit dashboard reads and visualizes those alerts. Training and preprocessing form a supporting model-development branch. Dashboard call paths are supported by excerpts; the README documents the live inference sequence, while the sniffer, trainer, and writer implementations were not excerpted.
Main entry points: app.py Dashboard Orchestrator · data_service.py Alert Queries and Metrics · db.py Read-only DB Access · models Random Forest Inference
Components 21
Live Detection
- Packet Sniffer
ml-engine/src/sniffer.py - Flow Aggregator
ml-engine/src/flow_aggregator.py - Random Forest Inference
ml-engine/models
Model Training
- Data Preprocessing
ml-engine/src/preprocessor.py - Model Training
ml-engine/src/train.py
Alert Storage
- Alert Writer
ml-engine/src/db_writer.py - SQLite Alerts
Dashboard
- Dashboard Orchestrator
dashboard/app.py - Alert Queries and Metrics
dashboard/services/data_service.py - Read-only DB Access
dashboard/services/db.py - Dashboard Configuration
dashboard/utils/config.py
Dashboard Components
- Filters and Refresh
dashboard/components/sidebar.py - Status Header
dashboard/components/header.py - Empty and Error States
dashboard/components/empty_state.py - KPI Cards
dashboard/components/kpi_cards.py - Alert Table
dashboard/components/alerts_table.py - Traffic Charts
dashboard/components/charts.py - Theme Styling
dashboard/utils/theme.py - Value Formatting
dashboard/utils/formatting.py
Other components
- Network Traffic
- CIC-IDS-2017 Dataset
Connections 27
- Network Traffic → Packet Sniffer: supplies packets
README.md - Packet Sniffer → Flow Aggregator: dispatches packets
ml-engine/src/sniffer.py - Flow Aggregator → Random Forest Inference: extracts features for
README.md - Packet Sniffer → Random Forest Inference: runs inference
README.md - Random Forest Inference → Alert Writer: passes alert
README.md - Alert Writer → SQLite Alerts: writes alerts
README.md - CIC-IDS-2017 Dataset → Data Preprocessing: provides training data
README.md - Model Training → Data Preprocessing: uses preprocessing
ml-engine/src/train.py - Model Training → Random Forest Inference: trains model
README.md - Dashboard Orchestrator → Read-only DB Access: checks connection
dashboard/app.py - Dashboard Orchestrator → Alert Queries and Metrics: loads alert data
dashboard/app.py - Alert Queries and Metrics → Read-only DB Access: executes queries
dashboard/services/data_service.py - Read-only DB Access → SQLite Alerts: reads
README.md - Dashboard Orchestrator → Filters and Refresh: renders filters
dashboard/app.py - Dashboard Orchestrator → Status Header: renders status
dashboard/app.py - Dashboard Orchestrator → Empty and Error States: renders states
dashboard/app.py - Dashboard Orchestrator → KPI Cards: renders metrics
dashboard/app.py - Dashboard Orchestrator → Alert Table: renders alerts
dashboard/app.py - Dashboard Orchestrator → Traffic Charts: renders charts
dashboard/app.py - Traffic Charts → Alert Queries and Metrics: requests chart data
dashboard/components/charts.py - Filters and Refresh → Dashboard Configuration: uses filter defaults
dashboard/components/sidebar.py - Read-only DB Access → Dashboard Configuration: uses database path
dashboard/services/db.py - Alert Queries and Metrics → Dashboard Configuration: uses severity threshold
dashboard/services/data_service.py - Dashboard Orchestrator → Theme Styling: applies theme
dashboard/app.py - Traffic Charts → Theme Styling: uses chart styling
dashboard/components/charts.py - Alert Table → Value Formatting: formats probabilities
dashboard/components/alerts_table.py - Status Header → Value Formatting: formats counts
dashboard/components/header.py