Skip to main content

A python package to detect attacks via networks

Project description

Detect Attacks:

A python package which detects network attacks includes:

  • Collecting data from attacks
  • Classifying data to predict the risks of the network attacks
  • Warning users risks which could be a network attack.

Getting Started

Prerequisites

  • These packages should be installed before using detect_attacks:
tensorflow	1.5.0
sklearn	0.19.1
keras	2.1.3
numpy	1.14.0
matplotlib	2.1.2
deepmg 0.5.9
  • Please install if you do not have them
pip install matplotlib
pip install numpy

conda install scikit-learn
conda install -c conda-forge tensorflow 
conda install -c conda-forge keras

pip install Keras-Applications
pip install Keras-Preprocessing
pip install keras_sequential_ascii

pip install deepmg

Install or Download the package detect_attacks

pip install detect_attacks

Running Experiments

How to use detect_attacks

  • Input:

    • mandatory: csv files containing data (*_x.csv) and labels (*_y.csv)
    • optional: if use external validation set: data (*_zx.csv) and labels (*_zy.csv)) put in data changable with parameters --orginal_data_folder).

    For examples, data1_x.csv and data1_y.csv for.

  • Output:

    • results: performance/training/testing information of each fold and summary results put in [results/name_dataset_parameters_to_generate_image/] (results/) (changable with parameters --parent_folder_results), includes more than 5 files:
      • *file_sum.txt: parameters used to run, performance at each fold. The last rows show training/testing performance in ACC, AUC, execution time, and other metrics of the experiment. When the experiment finishes, a suffix "_ok" (changable with parameters --suff_fini) appended to the name of file marking that the experiment finishes.

      • *file_eachfold.txt (if --save_folds=y): results of each fold with accuracy, auc, mcc, loss of training and testing.

      • *file_mean_acc.txt (if --save_avg_run=y): if the experiment includes n runs repeated independently, so the file includes average performance on k-folds of each run measured by accuracy and time execution at training/testing of beginning, training/testing when finished.

      • *file_mean_auc.txt (if --save_avg_run=y): if the experiment includes n runs repeated independently, so the file includes average performance on k-folds of each run measured by AUC at training/testing of beginning, training/testing when finished.

      • If --save_para=y: configuration file to repeat the experiment

      • If use --save_w=y (save weights of trained networks) and/or --save_entire_w=y, --save_d=y, then 2 folders will be created:

        • results/name_dataset_parameters_to_generate_image/models/: includes *weightmodel*.json contains structure of the model *weightmodel*.h5 stores weights.

        • results/name_dataset_parameters_to_generate_image/details/*weight_*.txt: contains accuracy and loss of training and testing every epochs --save_d=y. If --save_rf=y, then we will have important scores generated from RFs for each run.

Some examples

db_name='data1';
folder_data='/Users/hainguyen//test/data/';
folder_res='/Users/hainguyen//test/results/';

python -m detect_attacks -i $db_name -r $folder_data --parent_folder_results $folder_res --model rf_model
python -m detect_attacks -i $db_name -r $folder_data --parent_folder_results $folder_res --model svm_model
python -m detect_attacks -i $db_name -r $folder_data --parent_folder_results $folder_res --model model_cnn1d
python -m detect_attacks -i $db_name -r $folder_data --parent_folder_results $folder_res --model model_mlp
python -m detect_attacks -i $db_name -r $folder_data --parent_folder_results $folder_res --model fc_model

Download data

Please use the link below to download data for the experiments

darpa29f

References:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

detect_attacks-0.0.12.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

detect_attacks-0.0.12-py2-none-any.whl (4.3 kB view details)

Uploaded Python 2

File details

Details for the file detect_attacks-0.0.12.tar.gz.

File metadata

  • Download URL: detect_attacks-0.0.12.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15

File hashes

Hashes for detect_attacks-0.0.12.tar.gz
Algorithm Hash digest
SHA256 e9f809d649121da43c4f30ae3afeb6de341eee2f569363aa45ec5604ab804038
MD5 b4778872d7b48479d0ad933e11cd0ffd
BLAKE2b-256 1148840ef1dd496eb0c176de84fec6b47c110961afe9addba7eecf0bb18291f8

See more details on using hashes here.

File details

Details for the file detect_attacks-0.0.12-py2-none-any.whl.

File metadata

  • Download URL: detect_attacks-0.0.12-py2-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15

File hashes

Hashes for detect_attacks-0.0.12-py2-none-any.whl
Algorithm Hash digest
SHA256 422857d7503d2b26eaac11398295aca44d0fb36a9000913dbc5c335305cd8449
MD5 94c37872dbe208bf1d33b903c6a46e9b
BLAKE2b-256 74caedb5670697d5d44494a9aa15e35fa9535e86aba71c62b3b13fd894c8c8d6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page