A production‑ready, AI‑based intrusion detection system that classifies network traffic into 15 attack types using machine learning. The system includes a live dashboard with real‑time alerts, attack timeline visualisation, top attackers list, and IP blocking capabilities.
🎯 Problem & Motivation
Traditional signature‑based intrusion detection systems fail to detect novel or zero‑day attacks. This project uses machine learning to recognise attack patterns from millions of real‑world network flows. It provides a complete, end‑to‑end solution that can be deployed in a Security Operations Center (SOC).
Multi‑class attack detection – identifies 15 attack types (DDoS, DoS Hulk, PortScan, Bot, etc.)
Live dashboard – displays alerts, statistics, and attack timeline (auto‑refreshes)
Top attackers list – shows the most active malicious IPs with block buttons
IP blocking – one‑click simulated (or actual) blocking of attacking IPs
Upload & detect – process any CSV file generated by CICFlowMeter
High performance – trained on 2.8 million flows, near‑perfect detection for common attacks
We used the CICIDS2017 dataset , a benchmark for intrusion detection research.
Total flows: 2,830,743
Features: 78 network flow characteristics
Classes: 15 (BENIGN + 14 attack types)
The dataset is highly imbalanced , but the model still performs excellently on majority classes.
The dataset is highly imbalanced , but the model still performs excellently on majority classes.
🏗️ System Architecture
Python 3.11 or higher
Clone the repository git clone cd itrix-ai-ids
Create and activate a virtual environment
bash python -m venv venv source venv/bin/activate # Linux/macOS venv\Scripts\activate # Windows Install dependencies
bash pip install pandas numpy scikit-learn flask joblib Download the trained model (if not included) – the repository already contains ml/random_forest_full.pkl.
Prepare the dataset (optional) – the CICIDS2017 CSV files are not included due to size; you can download them from the official source.
🚀 Usage Start the Dashboard bash cd backend python app.py Open your browser at .
Detect Attacks Click Choose file and select a CSV file (from the dataset or generated by CICFlowMeter).
Click Upload CSV → the file is saved to the uploads/ folder.
Click Run Detection → the prediction script processes the file and writes alerts to alerts.json.
Wait a few seconds – the dashboard auto‑refreshes and displays the alerts.
Block an IP In the Top Attackers list or the Alerts Table, click the Block button to an IP.
The backend will simulate blocking (or actually block if you configure pf).
A confirmation message appears.
* The overall accuracy is inflated due to the majority class ( BENIGN ). The model performs excellently on common attacks such as DDoS, DoS Hulk, and PortScan , and adequately on rarer ones. Dataset: CICIDS2017 Total flows used for evaluation: ~2.8M Model: Random Forest
📊 Classification Report (Condensed)
Dashboard After Detection
🔮 Future Work Live packet capture – integrate with scapy or CICFlowMeter for real‑time monitoring.
Deep learning models – explore LSTM/CNN to improve detection of rare attacks.
Automated response – actually block IPs using firewall rules (pf/iptables).
Notifications – send alerts to Slack, email, or SMS.
Deployment – use gunicorn + supervisor for production.
🛠️ Technologies Used Python – core language
pandas, numpy – data handling
scikit‑learn – Random Forest classifier
Flask – web framework
Chart.js – frontend visualisation
HTML/CSS/JavaScript – dashboard frontend
📜 License This project is open‑source and available under the MIT License.
The Canadian Institute for Cybersecurity for the CICIDS2017 dataset.
The scikit‑learn and Flask communities for their excellent libraries.
Chandan Kumar Sah KPR Institute of Engineering and Technology
Project developed for ITRIX’26 Department of Information Science and Technology College of Engineering, Guindy (CEG) Anna University, Chennai
The full story
This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.
