This project aims to classify network traffic as VPN or Non-VPN using a Random Forest classifier. The model is trained on a dataset with various features extracted from network traffic and saved for future use.
nt_vpn_classifier.ipynb: Jupyter notebook containing the code to train and evaluate the Random Forest model.network_vpn_classifier.pkl: Saved model file for the Random Forest classifier.README.md: Project documentation.
Before running the project, ensure you have the following installed:
- Python 3.x
- Jupyter Notebook
- Required Python packages
-
Clone the Repository:
git clone git@github.com:akaasula21/network-traffic-classification.git cd network-traffic-classification -
Create a Virtual Environment (optional but recommended):
python -m venv nt_classi_env source nt_classi_env/bin/activate # On Windows, use `nt_classi_env\Scripts\activate` -
Install Required Packages:
pip install -r requirements.txt
-
Open Jupyter Notebook:
jupyter notebook -
Run the Notebook:
Open nt_vpn_classifier.ipynb in Jupyter Notebook. Execute the cells to load the dataset, preprocess the data, train the model, and evaluate its performance.
-
Save the Model:
After training, the model is saved as network_vpn_classifier.pkl.
To use the saved model for predictions, follow these steps:
-
Load the Model:
import joblib model = joblib.load('network_vpn_classifier.pkl') -
Make Predictions:
Prepare your input data to match the features used during training. Use the model to make predictions:
predictions = model.predict(input_data)
- Duration
- Total FIAT
- Total BIAT
- Min FIAT
- Min BIAT
- Max FIAT
- Max BIAT
- Mean FIAT
- Mean BIAT
- Flow Packets Per Second
- Std FIAT
- Min Active
- Mean Active
- Max Active
- Std Active
- Min Idle
- Mean Idle
- Max Idle
Random Forest Classifier
Accuracy, Precision, Recall, F1-Score
Contributions are welcome! Please fork the repository and submit a pull request for any improvements or additions.
This project is licensed under the MIT License.
Thanks to the dataset providers for making this project possible.
Special thanks to the Python and machine learning communities for their support and resources.