Real-time network intrusion detection pipeline β capture, analysis, visualization, and automated threat response.
Overview β’ Screenshots β’ Architecture β’ Installation β’ Usage
- Overview
- Screenshots
- Architecture
- Lab Topology
- Features
- Tech Stack
- Repository Structure
- Installation
- Usage
- Custom Suricata Rules
- Database Schema
- Known Limitations / Future Work
- Author
- License
This project implements a complete network intrusion detection and response pipeline:
- Suricata captures network traffic in real time and generates
structured alerts (
eve.json) based on standard rulesets (ET Open) and custom rules targeting common attack tools (Nmap, Hydra, Nikto, hping3). - A Python Parser continuously reads this stream and feeds a SQLite database.
- A Flask Dashboard queries this database to provide real-time visualization (KPIs, Chart.js graphs, search, filters).
- A Response Engine, fully independent from the dashboard, monitors the database and triggers automated responses (IP blocking, logging) once an alert threshold is exceeded.
π‘ Project built as part of a cybersecurity lab β TASK 4: Network Intrusion Detection System.
Real-time overview: component status, KPIs, activity charts.
Live search, combinable filters (severity, type, category, dates), full JSON detail per alert.
|
Advanced Statistics Top ports, protocols, categories, daily trends.
|
Blocked IPs History of automated blocks and manual unblocking.
|
π All screenshots live in
docs/screenshots/. See the checklist below if you're adding your own.
βββββββββββββββββββββββ
β Suricata (IDS) β
β β eve.json β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Python Parser β
β (streaming reader) β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β SQLite (alerts.db) β
ββββββββββββ¬βββββββββββ
β
ββββββββββββββββ΄βββββββββββββββ
βΌ βΌ
βββββββββββββββββββββββ βββββββββββββββββββββββ
β Flask Dashboard β β Response Engine β
β (read-only) β β (read + action) β
β Chart.js / REST API β β iptables / logs β
βββββββββββββββββββββββ βββββββββββββββββββββββ
Key principle: the Dashboard and the Response Engine are two independent processes that only share read access to the same SQLite database. This separation prevents a display bug from ever triggering a security action, and allows each component to restart independently without affecting the other.
Windows Host
β
VMware Workstation
β
VMnet (Host-Only)
β
βββββββββββββββββββββββΌββββββββββββββββββββββ
βΌ βΌ βΌ
Kali Linux Ubuntu Server Ubuntu Server
(Attacker) (Victim) (IDS)
192.168.10.12 192.168.10.11 192.168.10.10
Tools: Services: Tools:
- Nmap - Apache2 - Suricata 7.0.3
- Hydra - OpenSSH - Python Parser
- Nikto - vsftpd - Flask Dashboard
- hping3 - Test website - Response Engine
- curl - EveBox (optional)
- Standard ET Open rules + 10 custom rules targeting Nmap (SYN/NULL/FIN/XMAS scans), Hydra (SSH/FTP brute-force), Nikto, hping3 (low TTL, SYN flood)
- Live capture on a dedicated network interface
- Streaming reader of
eve.json(persisted offset, no full re-read) - Automatic attack-type resolution via a SID β tool mapping table
- Raw JSON preserved for full audit/detail
| Page | Description |
|---|---|
| Dashboard | System component status, KPIs, real-time charts |
| Alerts | Live search, combinable filters, pagination, JSON detail |
| Responses | History of automated Response Engine actions |
| Blocked IPs | List of blocked IPs with manual unblock |
| Statistics | Top ports, protocols, categories, daily trends |
| System | Detailed component status, system log |
| About | Project and architecture overview |
Configurable auto-refresh (5s / 10s / 30s).
- Continuous monitoring of alert thresholds per source IP
- Dry-run mode by default (simulation without real blocking, with full logging) β a safeguard against self-locking during testing
- Whitelist of protected IPs (e.g. the IDS itself)
- Real blocking via
iptables, enabled through configuration - Full decision history in
response_log
| Component | Technology |
|---|---|
| IDS engine | Suricata 7.0.3 |
| Processing / Parsing | Python 3.12 |
| Dashboard backend | Flask |
| Database | SQLite |
| Visualization | Chart.js, vanilla HTML/CSS/JS |
| Automated response | Python + iptables |
| Lab environment | VMware Workstation (Kali Linux, Ubuntu Server Γ2) |
nids-dashboard/
βββ app.py # Flask backend (API routes + pages)
βββ parser.py # eve.json β SQLite parser
βββ response_engine.py # Automated response engine
βββ schema.sql # Database schema creation script
βββ requirements.txt # Python dependencies
βββ suricata/
β βββ local.rules # Custom Suricata rules
βββ static/
β βββ css/
β β βββ style.css # Shared styles (dark theme)
β βββ js/
β βββ common.js # Clock, auto-refresh, system status
βββ templates/
β βββ base.html # Shared layout (header, nav, footer)
β βββ index.html # Dashboard page
β βββ alerts.html # Alerts page
β βββ responses.html # Responses page
β βββ blocked_ips.html # Blocked IPs page
β βββ statistics.html # Statistics page
β βββ system.html # System page
β βββ about.html # About page
βββ docs/
β βββ screenshots/ # Screenshots used in this README
βββ README.md
- Suricata installed and configured (see Custom Suricata Rules)
- Python 3.10+
- Read access to
/var/log/suricata/eve.json
# 1. Clone the repository
git clone https://github.com/CyberTechSali/CodeAlpha--Network-Intrusion-Detection-System.git
cd nids-dashboard
# 2. Create a virtual environment
python3 -m venv venv
source venv/bin/activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Initialize the database
sqlite3 alerts.db < schema.sql
# 5. Copy the custom rules into Suricata
sudo cp suricata/local.rules /var/lib/suricata/rules/local.rules
sudo suricata -T -c /etc/suricata/suricata.yaml -v # validate syntax
sudo systemctl restart suricataflask
The system requires 4 processes running simultaneously (4 terminals, or
a systemd/tmux service manager in production):
# Terminal 1 β Suricata (live network capture)
sudo suricata -c /etc/suricata/suricata.yaml -i <interface> -v
# Terminal 2 β Parser (eve.json β SQLite)
python3 parser.py
# Terminal 3 β Response Engine (monitoring + automated responses)
python3 response_engine.py
# Terminal 4 β Flask Dashboard (web interface)
python3 app.pyDashboard access: http://<IDS_machine_IP>:5000
File: suricata/local.rules
| SID | Description | Target Tool |
|---|---|---|
| 1000001 | Nikto User-Agent detection | Nikto |
| 1000002 | Nmap NSE script detection | Nmap |
| 1000003 | Nmap SYN scan | Nmap |
| 1000004 | Nmap NULL scan | Nmap |
| 1000005 | Nmap XMAS scan | Nmap |
| 1000006 | Nmap FIN scan | Nmap |
| 1000007 | SSH brute-force (Hydra) | Hydra |
| 1000008 | FTP brute-force (Hydra) | Hydra |
| 1000009 | Low TTL crafted packet (hping3) | hping3 |
| 1000010 | SYN Flood (hping3) | hping3 |
π‘ The SID β attack-type mapping is also stored in the database (
sid_mappingtable), which allows new rules to be added without modifying the Parser's Python code.
alerts -- Each parsed Suricata alert (timestamp, signature, IP,
-- ports, severity, attack type, raw JSON...)
sid_mapping -- Link between signature_id β attack_type (Nmap, Hydra, Nikto...)
blocked_ips -- History of IPs blocked by the Response Engine
response_log -- Full log of every Response Engine decision
-- (including simulation mode)See the full detail in schema.sql.
- Real blocking via
iptables(non-simulated mode) has not yet been validated under real conditions β the Response Engine runs in dry-run mode by default - File-based logging (
parser.log,response.log,flask.log) is not yet implemented; logs are currently only visible in the terminals - Real-time notifications and an activity timeline are not implemented
- Light/dark mode and responsive design still need to be finalized
- Some generic ET Open rules are not yet mapped in
sid_mapping(classified as "Unknown")
Salma Ouchahed Project built in 2026 as part of a cybersecurity lab β Network intrusion detection with Suricata.
Academic / educational project β free to use for learning purposes.
See LICENSE for details.
β If this project was useful to you, consider leaving a star on the repo.

