How steviegoneevil/ann-for-ddos-detection works
Project type and purpose
• This is a Python-based command-line tool (“ProjectANN.py”) for DDoS detection using an Artificial Neural Network (ANN).
• Core features (per README): packet sniffing, data gathering, dataset viewing, ANN training, live attack detection, and ANN visualization.
File structure
• Root script: ProjectANN.py – main CLI driver.
• Data folders:
• CSV Files/ – raw and processed CSV datasets.
• Test Models/ – pre-trained ANN model files (.sav).
• Misc, Previous Versions – history and utilities (not part of core real-time flow).
• Supporting scripts: DrawAnnv2.py – ANN visualizer.
• Artifacts: Model.sav, ModelWeights.txt – saved ANN outputs.
• Config: requirements.txt – Python dependencies (scikit-learn, pandas, matplotlib, pyshark).
README for architectural insights
• External dependencies: Python 3.6, Wireshark/Tshark/WinPcap, Visual C++ build tools (for pyshark).
• CLI menu drives six major modules (1–6).
• Data persists on disk as CSVs and .sav model files; logs written to log.txt.
a. Components
• CLI Controller (ProjectANN.py)
• Packet Capture Module (pyshark/Tshark)
• Data Preprocessing & Storage (pandas → CSV Files/)
• ANN Trainer (scikit-learn, numpy)
• Model Repository (Test Models/, Model.sav)
• Live Detection Engine (loads .sav, monitors network)
• Visualization Module (DrawAnnv2.py + matplotlib)
• Data Viewer (pandas CLI tool)
• External Systems: Network Interface, Disk Storage
b. Relationships & data flow
• CLI Controller invokes Packet Capture → streams packets → Data Preprocessor → writes CSV.
• CLI → ANN Trainer reads CSV → trains model → persists .sav → writes ModelWeights.txt.
• CLI → Data Viewer reads CSV → outputs to console.
• CLI → Live Detector loads .sav → captures live packets → classifies → raises alert or logs.
• CLI → Visualizer loads model structure → renders graph.
c. Architectural patterns
• File-based “loose coupling”: modules exchange data via disk (CSV and .sav).
• External library integration (pyshark for capture, scikit-learn for ML).
d. Key technologies
• Python 3.6, PyShark/Tshark, pandas, scikit-learn, numpy, matplotlib, pickle (.sav), CSV.