Skip to content

An experiment adding SMOTE to code with publication: Pytorch implementation of deep packet: a novel approach for encrypted traffic classification using deep learning

License

Notifications You must be signed in to change notification settings

ConorGagliardi/Deep-Packet

 
 

Repository files navigation

Deep Packet

This a fork from the original implementation at https://github.com/munhouiani/Deep-Packet

Below is the list of files that were modified for the experiment:

To setup the project on an ICL6 machine

  1. Create an environment via conda
  • For Linux (CUDA 10.6)

    conda env create -f env_linux_cuda116.yaml
  1. Download the pre-processed dataset from small dataset

  2. Create a directory called processed_small and extract the contents of the downloaded dataset

    mkdir processed_small
    tar -xvzf processed_small.tar.gz -C processed_small

Create Train/Test split using Random Under-Sampling (baseline)

python create_train_test_set.py --source ~/datasets/processed_small --train ~/datasets/undersampled_train_split --test ~/datasets/test_split --class_balancing under_sampling

Create Train/Test split using SMOTE and Random Under-Sampling (experiment)

  • Minority classes (c): 2
  • Nearest Neighbors (k): 5
  • Amount of SMOTE (n): 1, 2, 3, 4, 5
python create_train_test_set.py --source ~/datasets/processed_small --train ~/datasets/smote_c2_n2_k5_train_split --test ~/datasets/test_split --class_balancing SMOTE+under_sampling -c 2 -n 2 -k 5 -t app --skip_test 1

Train Model

Application Classification

python train_cnn.py -d ~/datasets/smote_c2_n1_k5_train_split/application_classification/train.parquet -m model/application_classification.cnn.model.smote.c2n1k5 -t app

Test Model

Application Classification

python test_cnn.py -d ~/datasets/test_split/application_classification/test.parquet -m model/application_classification.cnn.model.smote.c2n1k5 -t app -p c2n1k5

(Optional) Data reporting script to show the label distribution for any train/test split

python data_reports.py -p /path/to/datasets/test_split/application_classification/test.parquet -t app -o app_test_data_dist.png

(Optional) Data Pre-processing script for raw pcap files.

python preprocessing.py -s /path/to/pcap_files -t /path/to/datasets/processed_new

About

An experiment adding SMOTE to code with publication: Pytorch implementation of deep packet: a novel approach for encrypted traffic classification using deep learning

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%