Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ ShieldNet

Python Flask TensorFlow License Status ML

AI-powered network intrusion detection system β€” classifies DoS, DDoS, PortScan, and Brute Force attacks using Machine Learning and Deep Learning, with a Flask web interface for real-time prediction.


⚠️ Disclaimer

This project is developed for educational and research purposes only. It demonstrates intrusion detection concepts using the CIC-IDS2017 benchmark dataset and is not intended for production deployment without further hardening.


Overview

ShieldNet is an end-to-end network intrusion detection system (NIDS) that combines classical machine learning and deep learning to classify malicious network traffic. It processes both benchmark dataset traffic and custom Wireshark-captured PCAPs β€” from raw packets all the way to a web-based prediction interface.

The system detects:

  • DoS (Denial of Service)
  • DDoS (Distributed Denial of Service)
  • PortScan (Network Reconnaissance)
  • Brute Force (Credential Attacks)
  • Benign (Normal Traffic)

Images

image image image

System Pipeline

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        SHIELDNET PIPELINE                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚              DATA SOURCES                               β”‚   β”‚
β”‚  β”‚  CIC-IDS2017 Dataset  |  Custom PCAP (Wireshark/tshark) β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                            β”‚                                    β”‚
β”‚                            β–Ό                                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚              PREPROCESSING (notebook(prep)/)            β”‚   β”‚
β”‚  β”‚  Feature extraction β†’ Cleaning β†’ Normalization          β”‚   β”‚
β”‚  β”‚  Feature selection β†’ SMOTE (class imbalance)            β”‚   β”‚
β”‚  β”‚  Feature alignment (dataset ↔ custom traffic)           β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                            β”‚                                    β”‚
β”‚                            β–Ό                                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚              MODEL TRAINING (notebooks/)                β”‚   β”‚
β”‚  β”‚                                                         β”‚   β”‚
β”‚  β”‚  Machine Learning:        Deep Learning:                β”‚   β”‚
β”‚  β”‚  - Logistic Regression    - ANN (Artificial Neural Net) β”‚   β”‚
β”‚  β”‚  - Random Forest          - CNN (Convolutional NN)      β”‚   β”‚
β”‚  β”‚  - SVM                    - LSTM (Long Short-Term Mem)  β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                            β”‚                                    β”‚
β”‚                            β–Ό                                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚              MODEL SERIALIZATION (models/)              β”‚   β”‚
β”‚  β”‚  Trained models + Scaler + Label Encoder                β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                            β”‚                                    β”‚
β”‚                            β–Ό                                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚              FLASK WEB APP (app.py)                     β”‚   β”‚
β”‚  β”‚  Upload traffic β†’ Select model β†’ Get prediction         β”‚   β”‚
β”‚  β”‚  Supports dataset input + custom PCAP input             β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Models Implemented

Model Type Purpose
Logistic Regression Machine Learning Baseline classifier
Random Forest Machine Learning Ensemble, high accuracy
SVM Machine Learning Margin-based classification
ANN Deep Learning Feedforward neural network
CNN Deep Learning Pattern recognition in traffic features
LSTM Deep Learning Sequential/temporal traffic analysis

Dataset

  • CIC-IDS2017 β€” Canadian Institute for Cybersecurity benchmark dataset containing labeled network flows for DoS, DDoS, PortScan, Brute Force, and Benign traffic
  • Custom traffic β€” Captured using Wireshark, processed with tshark for feature extraction
  • Class imbalance β€” Handled using SMOTE (Synthetic Minority Oversampling Technique)
  • Feature alignment β€” Ensures consistency between CIC-IDS2017 features and custom-captured traffic features

Project Structure

ShieldNet/
β”‚
β”œβ”€β”€ app.py                    # Flask web application β€” prediction + interface
β”‚
β”œβ”€β”€ models/
β”‚   └── final_dl_models/      # Trained models, scaler, label encoder
β”‚
β”œβ”€β”€ notebooks/                # Model training, EDA, experimentation
β”‚
β”œβ”€β”€ notebook(prep)/           # Data preprocessing and feature alignment
β”‚
β”œβ”€β”€ templates/                # HTML frontend templates
β”‚
β”œβ”€β”€ static/                   # CSS and UI assets
β”‚
β”œβ”€β”€ assets/                   # Images and visualizations
β”‚
β”œβ”€β”€ requirements.txt
└── .gitignore

Tech Stack

Component Technology
Backend Python, Flask
Machine Learning Scikit-learn
Deep Learning TensorFlow / Keras
Data Processing Pandas, NumPy
Class Balancing imbalanced-learn (SMOTE)
Traffic Capture Wireshark, tshark
Frontend HTML, CSS

Installation

Clone the repository:

git clone https://github.com/Ki1shan/ShieldNet.git
cd ShieldNet

Install dependencies:

pip install -r requirements.txt

Run the application:

python app.py

Open in browser:

http://127.0.0.1:5000/

Key Concepts

  • Network Intrusion Detection (NIDS) β€” passive monitoring and classification of network flows
  • CIC-IDS2017 β€” industry-standard benchmark dataset for IDS research
  • SMOTE β€” synthetic data generation to handle severe class imbalance in attack datasets
  • Feature Engineering β€” extraction of flow-level statistics from raw packet captures
  • Multi-class Classification β€” simultaneous detection of multiple attack types in a single model
  • PCAP Processing β€” raw packet capture β†’ tshark β†’ feature vector β†’ model prediction

Future Improvements

  • Live network traffic capture integration
  • Real-time streaming analysis
  • Model optimization for higher accuracy
  • Cloud deployment (AWS/GCP)
  • SIEM integration (Splunk, ELK)
  • API endpoint for programmatic prediction

Author

Kishan N Offensive Security Engineer | AI/ML Security Researcher

Built ShieldNet to bridge the gap between machine learning research and practical network security β€” applying deep learning techniques to real-world intrusion detection challenges.


License

MIT License β€” see LICENSE file for details.


Traffic doesn't lie. The model just needs to learn how to listen.

About

AI-powered network IDS using ML + Deep Learning (ANN, CNN, LSTM) to detect DoS, DDoS, PortScan and Brute Force attacks | CIC-IDS2017 | Flask

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages