How chiragbiradar/ddos-attack-detection-and-mitigation works
Project Type and Purpose
• This is a specialized network security application designed to detect and mitigate distributed denial-of-service (DDoS) attacks in a software-defined networking (SDN) environment.
• The system uses simulated network traffic (via Mininet) and an SDN controller (Ryu) to collect flow data. It then applies machine learning (ML) algorithms (e.g., Random Forest, Decision Trees, SVM, KNN) to distinguish between normal and malicious traffic and subsequently enact mitigation measures.
Analyzing the File Structure
• The Codes directory is subdivided into several functional subdirectories:
• Codes/mininet: Contains scripts (e.g., topology.py, generate_ddos_trafic.py, generate_benign_trafic.py) for simulating network topologies and traffic. This represents the Infrastructure Layer.
• Codes/controller: Contains modules for interacting with the Ryu controller (e.g., controller.py, collect_ddos_trafic.py, start_traffic_collection.py) as well as temporary testing files for different ML algorithms. This folder is part of the Control Layer which gathers network flow statistics using OpenFlow.
• Codes/ml: Contains the implementations for various machine learning algorithms (e.g., RF.py, DT.py, KNN.py, SVM.py, LR.py, NB.py) which are primarily used for traffic classification (Detection Module).
• Codes/Mitigation: Contains the mitigation module scripts (e.g., mitigation_module.py and switch-related scripts) that actively block or adjust flows based on the detection results (Mitigation Module).
• Other directories like Installation_setup provide guidance on setting up the environment.
Key Architectural Components
• Infrastructure Layer:
• Mininet environment & simulated network: Show physical/virtual switches and hosts.
• Traffic Generators: Indicate separate scripts for generating malicious (DDoS) and legitimate traffic.
• Control Layer:
• SDN Controller (Ryu): Represent the Ryu controller’s role in flow collection from switches.
• Flow Collector/Traffic Control Module: Illustrate how network traffic and flow stats are requested from and received by the Ryu controller.
• Application Layer:
• Detection Module: Show the ML-based analyzer that processes collected flow data. Emphasize the use of multiple ML algorithms (Random Forest, SVM, KNN, etc.) stored in the Codes/ml directory.
• Mitigation Module: Indicate the component (from Codes/Mitigation and parts of Codes/controller) that applies mitigation measures—e.g., installing firewall rules or modifying switch flow entries—to block malicious flows.
• Data Flow:
Architectural Patterns & Key Design Principles
• The solution embraces a layered SDN architecture:
• Infrastructure Layer (physical/virtualized network elements).
• Control Layer (centralized management via the Ryu controller).
• Application Layer (network management applications including monitoring, detection, and mitigation).
• Emphasis on modularity is shown by separating containment responsibilities (traffic generation, ML detection, mitigation).
• Real-time data collection and processing: Indicating the periodic flow collection (every few seconds) and rapid detection to meet performance requirements.
• Machine Learning Integration: Highlight that the detection module employs several ML algorithms to classify traffic flows accurately and that the Random Forest algorithm emerged as the most effective per the README.
Additional Elements
• Labels for data flows (e.g., “flow stats”, “traffic data”, “mitigation commands”).
• Optional: Annotations for performance timing constraints (e.g., “Traffic analyzed every 5s”, “Mitigation within 2 minutes”) as described under Non-Functional Requirements.