How ruchitbhalerao/network-intrusion-detection-and-live-monitoring works
This is a localhost network intrusion-monitoring application. Its main workflow is optional synthetic or real packet input, normalization into packet records, five independent detection rules plus deduplication, and SQLite persistence; a read-only JSON API and two dashboard views expose alerts, devices, statistics, and traffic summaries. Configuration and traffic metering are supporting runtime layers. The README documents the overall flow; source excerpts establish the engine, API, and application-startup relationships, while some capture and web wiring is documented rather than excerpted.
Main entry points: engine.py Detection engine · run.py Application startup · api.py Read-only JSON API · base.py Detector interface
Components 23
Traffic inputs
- Application startup
run.py - Configuration
nids/config.py - Packet capture
nids/capture.py - Synthetic live feed
nids/livefeed.py - Synthetic records
nids/synthetic.py
Detection pipeline
- Packet parser
nids/parser.py - Packet and event models
nids/models.py - Detection engine
nids/engine.py - Port-scan rule
nids/detectors/port_scan.py - Rate-anomaly rule
nids/detectors/rate_anomaly.py - ARP-anomaly rule
nids/detectors/arp_anomaly.py - Unknown-device rule
nids/detectors/unknown_device.py - Repeated-connection rule
nids/detectors/repeated_connections.py - Detector interface
nids/detectors/base.py - Alert deduplication
nids/dedup.py
State and metrics
- SQLite store
nids/db.py - Traffic meter
nids/metrics.py
API and dashboard
- Read-only JSON API
nids/api.py - Web route registration
nids/web/__init__.py - Alerts dashboard
nids/web/static/app.js - Live traffic view
nids/web/static/live.js
Other components
- Operator
- Dashboard user
Connections 31
- Operator → Application startup: starts
README.md - Application startup → Configuration: loads
run.py - Application startup → Read-only JSON API: builds
run.py - Application startup → Synthetic live feed: starts optionally
run.py - Application startup → Packet capture: starts optionally
run.py - Synthetic live feed → Synthetic records: generates records
nids/livefeed.py - Synthetic live feed → Detection engine: processes records
nids/livefeed.py - Synthetic live feed → SQLite store: stores devices
nids/livefeed.py - Packet capture → Packet parser: parses packets
README.md - Packet capture → Detection engine: feeds records
README.md - Packet parser → Packet and event models: creates records
nids/parser.py - Detection engine → Port-scan rule: checks records
nids/engine.py - Detection engine → Rate-anomaly rule: checks records
nids/engine.py - Detection engine → ARP-anomaly rule: checks records
nids/engine.py - Detection engine → Unknown-device rule: checks records
nids/engine.py - Detection engine → Repeated-connection rule: checks records
nids/engine.py - Port-scan rule → Detector interface: inherits
nids/detectors/port_scan.py - Rate-anomaly rule → Detector interface: inherits
nids/detectors/rate_anomaly.py - ARP-anomaly rule → Detector interface: inherits
nids/detectors/arp_anomaly.py - Unknown-device rule → Detector interface: inherits
nids/detectors/unknown_device.py - Repeated-connection rule → Detector interface: inherits
nids/detectors/repeated_connections.py - Detection engine → Alert deduplication: suppresses duplicates
nids/engine.py - Detection engine → SQLite store: stores alerts
nids/engine.py - Detection engine → Traffic meter: records traffic
nids/engine.py - Traffic meter → SQLite store: writes traffic
nids/metrics.py - Read-only JSON API → SQLite store: reads stored data
nids/api.py - Read-only JSON API → Web route registration: registers routes
nids/api.py - Dashboard user → Alerts dashboard: views alerts
README.md - Alerts dashboard → Read-only JSON API: requests JSON
README.md - Dashboard user → Live traffic view: views traffic
README.md - Live traffic view → Read-only JSON API: requests traffic
README.md