Code Monkey home page Code Monkey logo

metis's Introduction

Metis

Metis: Understanding and Enhancing Regular Expressions in Network

Dataset Architecture

-- Data
  -- snort
    -- <rule name>
      -- <rule name>.csv
      -- dataset-<label ratio>.pkl

Code Architecture

-- ByteLevelTokenization
   -- create_logic_mat_bias.py
   -- create_snort_automata.py
   -- decompose_snort_automata.py
   -- dfa_from_rule.py
   -- fsa_to_tensor.py
   -- load_dataset.py
   -- process_snort_data.py
-- Distilltion
  -- RNNeval.py
  -- SSPKD.py
  -- SoftTree.py
-- Hardware
  -- data_plane.p4
-- models
   -- BRNN.py
   -- BRNN_O.py
   -- Baseline.py
   -- net.py
-- utils
   -- data.py
   -- utils.py
-- RE.py
-- README.md
-- requirements.txt
-- run_dfa2brnn.py
-- train_brnn.py
-- val.py

Run Code

Byte-Level Tokenization

Download Snort rules and unzip them to "./data/snort/rules/".

https://www.snort.org/downloads

Process Snort rules.

python3 process_snort_data.py

Create m-DFA based on Snort rules.

# to create "category_name"'s m-DFA of Snort, save as "automata_name"
python3 create_snort_automata.py --dataset category_name --automata_name automata_name

Prepare byte-level dataset.

# to prepare "category_name" datset, divide into training set, test set and val set with 7:2:1 and using 1% training data.
python3 load_dataset.py --dataset category_name --test_split 0.1 --val_split 0.2 --datset_split 0.01

Run DFA2BRNN

Train a BRNN.

# to train a BRNN based on "category_name", see more parameters in our source code.
python3 run_dfa2BRNN --dataset "category_name" --model_type Onehot

Train other baselines (e.g., LSTM).

# to train a LSTM based on "category_name", see more parameters in our source code.
python3 run_dfa2BRNN --dataset "category_name" --model_type MarryUp -rnn LSTM

Run RNNeval

This code is used for generate soft labels after BRNN training.

# to get the soft labels generated by BRNN of chat trained by 1% labeled data
python3 RNNeval --mode_name chat_0.01.m

Run SSPKD

This code is used for training and testing of SRF after generating soft labels.

# to train SRFs with 1% labeled data.
python3 SSPKD --mode train --label_r 0.01
# to train SRFs with 10% labeled data.
python3 SSPKD --mode train --label_r 0.1
# to train SRFs with 100% labeled data.
python3 SSPKD --mode train --label_r 1
# to test SRF of chat trained by 1% labeled data.
python3 SSPKD --mode test --snort_name chat --label_r 0.01
# to test baselines.
python3 SSPKD --mode <baseline name(dt, dtdistill, rf, rfdistill)> --snort_name <str> label_r <float>

metis's People

Contributors

helioshuang avatar youarespecialtome avatar imbaplayer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.