# adityak-101/network-intrusion-detection-system architecture

> Architecture diagram of the GitHub repository adityak-101/network-intrusion-detection-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adityak-101/network-intrusion-detection-system
- Repository: https://github.com/adityak-101/network-intrusion-detection-system

## Overview

This is a deterministic, real-time host intrusion detection system. Its main workflow captures IPv4 TCP/UDP packets, normalizes them, builds bidirectional flows and metrics, applies three detection layers, fuses their evidence into an explainable verdict, then presents and audits the result. The README documents the end-to-end flow; sampled source confirms packet conversion, flow construction, engine behavior, and dashboard handling. Simulation modules are included as a supporting capability. Some wiring is documented rather than visible in the excerpts.

Main entry points: [`simulation/run_demo.py`](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/run_demo.py) (Demo runner), [`main.py`](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/main.py) (Runtime orchestration), [`dashboard/app.py`](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/dashboard/app.py) (Live dashboard), [`capture/packet_capture.py`](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/capture/packet_capture.py) (Packet capture)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Traffic capture"]
  node_packet_capture["Packet capture<br/>[packet_capture.py]"]
  node_packet_info["Packet normalization<br/>[packet_info.py]"]
  node_domain_enrichment["DNS enrichment"]
  node_flow_builder["Flow construction<br/>[flow_builder.py]"]
end

subgraph group_detect["Detection and fusion"]
  node_level1["Rules engine<br/>[level1_rules.py]"]
  node_behavior["Behavior engine<br/>[behavior_engine.py]"]
  node_correlation["Correlation engine"]
  node_runtime["Runtime orchestration<br/>[main.py]"]
  node_fusion["Verdict fusion<br/>[main.py]"]
end

subgraph group_present["Presentation and audit"]
  node_dashboard["Live dashboard<br/>[app.py]"]
  node_flow_table["Live flow table<br/>[index.html]"]
  node_flow_detail["Flow detail view<br/>[detail.html]"]
  node_audit_log["CSV audit log<br/>[app.py]"]
end

subgraph group_sim["Attack simulations"]
  node_demo_runner["Demo runner<br/>[run_demo.py]"]
  node_brute_force["Brute-force scenario<br/>[brute_force.py]"]
  node_dos["DoS scenario<br/>[dos_attack.py]"]
  node_fusion_showcase["Fusion showcase<br/>[fusion_showcase.py]"]
  node_ping_sweep["Ping-sweep scenario<br/>[ping_sweep.py]"]
  node_port_scan["Port-scan scenario<br/>[port_scan.py]"]
  node_slowloris["Slowloris scenario<br/>[slowloris.py]"]
  node_ssh_spray["SSH spray scenario"]
end

node_operator(("IDS operator"))
node_network(("Live network"))

node_network -->|"supplies traffic"| node_packet_capture
node_packet_capture -->|"normalizes packets"| node_packet_info
node_packet_capture -.->|"observes DNS"| node_domain_enrichment
node_packet_capture -->|"hands off packets"| node_flow_builder
node_flow_builder -->|"consumes packets"| node_packet_info
node_flow_builder -->|"completes flows"| node_runtime
node_runtime -->|"runs rules"| node_level1
node_runtime -->|"runs behavior"| node_behavior
node_runtime -->|"runs correlation"| node_correlation
node_runtime -->|"computes verdict"| node_fusion
node_runtime -->|"streams results"| node_dashboard
node_dashboard -->|"renders table"| node_flow_table
node_dashboard -->|"renders details"| node_flow_detail
node_dashboard -->|"writes records"| node_audit_log
node_operator -->|"reviews results"| node_dashboard
node_demo_runner -->|"launches scenario"| node_brute_force
node_demo_runner -->|"launches scenario"| node_dos
node_demo_runner -->|"launches scenario"| node_fusion_showcase
node_demo_runner -->|"launches scenario"| node_ping_sweep
node_demo_runner -->|"launches scenario"| node_port_scan
node_demo_runner -->|"launches scenario"| node_slowloris
node_demo_runner -->|"launches scenario"| node_ssh_spray

click node_packet_capture "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/capture/packet_capture.py"
click node_packet_info "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/capture/packet_info.py"
click node_domain_enrichment "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/capture/domain_enrichment.py"
click node_flow_builder "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/capture/flow_builder.py"
click node_level1 "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/detection/level1_rules.py"
click node_behavior "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/detection/behavior_engine.py"
click node_correlation "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/detection/correlation_engine.py"
click node_runtime "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/main.py"
click node_fusion "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/main.py"
click node_dashboard "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/dashboard/app.py"
click node_flow_table "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/dashboard/templates/index.html"
click node_flow_detail "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/dashboard/templates/detail.html"
click node_audit_log "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/dashboard/app.py"
click node_demo_runner "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/run_demo.py"
click node_brute_force "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/brute_force.py"
click node_dos "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/dos_attack.py"
click node_fusion_showcase "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/fusion_showcase.py"
click node_ping_sweep "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/ping_sweep.py"
click node_port_scan "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/port_scan.py"
click node_slowloris "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/slowloris.py"
click node_ssh_spray "https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/ssh_credential_spray_lowrate.py"

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_packet_capture,node_packet_info,node_domain_enrichment,node_flow_builder toneBlue
class node_level1,node_behavior,node_correlation,node_runtime,node_fusion toneAmber
class node_dashboard,node_flow_table,node_flow_detail,node_audit_log toneMint
class node_demo_runner,node_brute_force,node_dos,node_fusion_showcase,node_ping_sweep,node_port_scan,node_slowloris,node_ssh_spray toneRose
class node_operator,node_network toneIndigo
```

## Components

### Traffic capture

- [Packet capture](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/capture/packet_capture.py): `capture/packet_capture.py`
- [Packet normalization](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/capture/packet_info.py): `capture/packet_info.py`
- [DNS enrichment](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/capture/domain_enrichment.py): `capture/domain_enrichment.py`
- [Flow construction](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/capture/flow_builder.py): `capture/flow_builder.py`

### Detection and fusion

- [Rules engine](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/detection/level1_rules.py): `detection/level1_rules.py`
- [Behavior engine](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/detection/behavior_engine.py): `detection/behavior_engine.py`
- [Correlation engine](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/detection/correlation_engine.py): `detection/correlation_engine.py`
- [Runtime orchestration](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/main.py): `main.py`
- [Verdict fusion](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/main.py): `main.py`

### Presentation and audit

- [Live dashboard](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/dashboard/app.py): `dashboard/app.py`
- [Live flow table](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/dashboard/templates/index.html): `dashboard/templates/index.html`
- [Flow detail view](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/dashboard/templates/detail.html): `dashboard/templates/detail.html`
- [CSV audit log](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/dashboard/app.py): `dashboard/app.py`

### Attack simulations

- [Demo runner](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/run_demo.py): `simulation/run_demo.py`
- [Brute-force scenario](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/brute_force.py): `simulation/brute_force.py`
- [DoS scenario](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/dos_attack.py): `simulation/dos_attack.py`
- [Fusion showcase](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/fusion_showcase.py): `simulation/fusion_showcase.py`
- [Ping-sweep scenario](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/ping_sweep.py): `simulation/ping_sweep.py`
- [Port-scan scenario](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/port_scan.py): `simulation/port_scan.py`
- [Slowloris scenario](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/slowloris.py): `simulation/slowloris.py`
- [SSH spray scenario](https://github.com/adityak-101/network-intrusion-detection-system/blob/main/simulation/ssh_credential_spray_lowrate.py): `simulation/ssh_credential_spray_lowrate.py`

### Other components

- **IDS operator**
- **Live network**

## Connections

- Live network → Packet capture: supplies traffic (evidence: `README.md`)
- Packet capture → Packet normalization: normalizes packets (evidence: `capture/packet_capture.py`)
- Packet capture → DNS enrichment: observes DNS (evidence: `capture/packet_capture.py`)
- Packet capture → Flow construction: hands off packets (evidence: `README.md`)
- Flow construction → Packet normalization: consumes packets (evidence: `capture/flow_builder.py`)
- Flow construction → Runtime orchestration: completes flows (evidence: `README.md`)
- Runtime orchestration → Rules engine: runs rules (evidence: `README.md`)
- Runtime orchestration → Behavior engine: runs behavior (evidence: `README.md`)
- Runtime orchestration → Correlation engine: runs correlation (evidence: `README.md`)
- Runtime orchestration → Verdict fusion: computes verdict (evidence: `main.py`)
- Runtime orchestration → Live dashboard: streams results (evidence: `README.md`)
- Live dashboard → Live flow table: renders table (evidence: `README.md`)
- Live dashboard → Flow detail view: renders details (evidence: `README.md`)
- Live dashboard → CSV audit log: writes records (evidence: `dashboard/app.py`)
- IDS operator → Live dashboard: reviews results (evidence: `README.md`)
- Demo runner → Brute-force scenario: launches scenario (evidence: `simulation/run_demo.py`)
- Demo runner → DoS scenario: launches scenario (evidence: `simulation/run_demo.py`)
- Demo runner → Fusion showcase: launches scenario (evidence: `simulation/run_demo.py`)
- Demo runner → Ping-sweep scenario: launches scenario (evidence: `simulation/run_demo.py`)
- Demo runner → Port-scan scenario: launches scenario (evidence: `simulation/run_demo.py`)
- Demo runner → Slowloris scenario: launches scenario (evidence: `simulation/run_demo.py`)
- Demo runner → SSH spray scenario: launches scenario (evidence: `simulation/run_demo.py`)
