How pranesh-22kk/dos_attack_detection works
This repository is a WSN denial-of-service detection project. Its main workflow prepares and scales labeled traffic data, creates temporal train/validation/test splits, trains sequence classifiers, then processes UDP traffic at a gateway and publishes detections to a web dashboard. Separate node simulators represent normal and attack traffic. The tree and excerpts support the preprocessing, LSTM training, gateway inference, and Flask update flow; several listed gateway helpers and CNN/GRU training modules were not sampled, so their runtime relationships are not asserted.
Main entry points: gateway_detector.py Gateway detector · scale_features.py Feature scaling · lstm_model.h5 LSTM model · app.py Status API
Components 26
Data preparation
- WSN-DS data
WSN_DoS_Detection/dataset/WSN-DS.csv - Label encoding
WSN_DoS_Detection/preprocessing/encode_labels.py - Feature selection
WSN_DoS_Detection/preprocessing/clean_and_select_features.py - Feature scaling
WSN_DoS_Detection/preprocessing/scale_features.py - Scaled dataset
WSN_DoS_Detection/dataset/WSN-DS-scaled.csv
Model training
- Sequence splitting
WSN_DoS_Detection/training/train_val_test_split.py - Sequence creation
WSN_DoS_Detection/training/create_sequences.py - LSTM training
WSN_DoS_Detection/training/train_lstm.py - CNN training
WSN_DoS_Detection/training/train_cnn.py - GRU training
WSN_DoS_Detection/training/train_gru.py - LSTM model
WSN_DoS_Detection/models/lstm_model.h5 - Fitted scaler
WSN_DoS_Detection/models/scaler.save - Model evaluation
WSN_DoS_Detection/training/evaluate_lstm.py
Realtime detection
- Normal node
WSN_DoS_Detection/realtime/nodes/normal_node.py - Flooding node
WSN_DoS_Detection/realtime/nodes/flooding_node.py - Blackhole node
WSN_DoS_Detection/realtime/nodes/blackhole_node.py - Grayhole node
WSN_DoS_Detection/realtime/nodes/grayhole_node.py - Gateway detector
WSN_DoS_Detection/realtime/gateway/gateway_detector.py - Gateway listener
WSN_DoS_Detection/realtime/gateway/gateway_listener.py - Feature aggregator
WSN_DoS_Detection/realtime/gateway/feature_aggregator.py - Sequence builder
WSN_DoS_Detection/realtime/gateway/sequence_builder.py - Realtime detector
WSN_DoS_Detection/realtime/gateway/realtime_detector.py - Alert manager
WSN_DoS_Detection/realtime/gateway/alert_manager.py
Dashboard
- Status API
WSN_DoS_Detection/realtime/web/app.py - Dashboard view
WSN_DoS_Detection/realtime/web/templates/dashboard.html
Other components
- Operator
Connections 18
- WSN-DS data → Label encoding: loads
WSN_DoS_Detection/preprocessing/encode_labels.py - Label encoding → Feature selection: writes encoded data
WSN_DoS_Detection/preprocessing/encode_labels.py - Feature selection → Feature scaling: writes final data
WSN_DoS_Detection/preprocessing/scale_features.py - Feature scaling → Scaled dataset: writes scaled data
WSN_DoS_Detection/preprocessing/scale_features.py - Feature scaling → Fitted scaler: saves scaler
WSN_DoS_Detection/preprocessing/scale_features.py - Scaled dataset → Sequence splitting: loads
WSN_DoS_Detection/training/train_val_test_split.py - Sequence splitting → LSTM training: saves training splits
WSN_DoS_Detection/training/train_val_test_split.py - LSTM training → LSTM model: saves checkpoint
WSN_DoS_Detection/training/train_lstm.py - LSTM model → Model evaluation: loads for evaluation
WSN_DoS_Detection/training/evaluate_lstm.py - Normal node → Gateway detector: sends UDP
- Flooding node → Gateway detector: sends UDP
WSN_DoS_Detection/realtime/nodes/flooding_node.py - Blackhole node → Gateway detector: sends drop notice
WSN_DoS_Detection/realtime/nodes/blackhole_node.py - Grayhole node → Gateway detector: sends traffic
- LSTM model → Gateway detector: predicts with
WSN_DoS_Detection/realtime/gateway/gateway_detector.py - Fitted scaler → Gateway detector: scales features
WSN_DoS_Detection/realtime/gateway/gateway_detector.py - Gateway detector → Status API: posts detection
WSN_DoS_Detection/realtime/gateway/gateway_detector.py - Operator → Status API: views status
WSN_DoS_Detection/realtime/web/app.py - Status API → Dashboard view: renders
WSN_DoS_Detection/realtime/web/app.py