This project uses artificial intelligence to detect DDoS attacks on a network based on a machine learning model. It utilizes a network traffic dataset to train a classification model that can identify whether traffic is normal or malicious.
- Python
- Pandas
- Scikit-learn
- Random Forest Classifier
git clone https://github.com/Rizki033/Python-AI-based-DDoS-Detection.gitMake sure Python is installed, then use pip to install the required libraries:
pip install pandas scikit-learn- Run data.py to generate the Network_data.csv file:
python data.py
- Run app.py to train the model and test detection:
python app.py
- Load data from Network_data.csv
- Encode categorical variables (protocol_type, service, flag)
- Split data into input variables (X) and output labels (y)
- Divide into training and testing sets
- Use RandomForestClassifier to train a model for DDoS attack detection
- A test_network function is provided to test new data for potential attacks
results data : 1:normal
results data : 2:normal
results data : 3:attack
results data : 4:normal