GithubHelp home page GithubHelp logo

dragon-defender's Introduction

Dragon Defender: Runtime Threat Detection for Cellular Devices

This repository contains the implementation and evaluation for the paper "Dragon Defender: Runtime Threat Detection for Cellular Devices."

Instructions

Please follow the instructions below to use and reproduce Dragon Defender's results.

Step 1: Process Traces

Let's start from raw traces - each example is a message (containing all feature values) and a label.

  • Download the traces from the raw traces link above
  • Unzip the downloaded file
  • Create a folder traces and move the unzipped traces there
cd trace_process

To train the Window Encoder, each train/test example is a sliding window (i.e., 31 consecutive messages, right padded) and a window label. Execute

python sliding_window.py

to construct sliding windows. The results will be saved in the directory traces/pretrain.

To train the Message Tagger, each train/test example is the sequence of messages in one session. Execute

python trace2example.py

to construct train/test examples. The results will be saved in the directory traces/train.

Step 2: Prepare Dataset

Now, we can prepare the training and test set. Execute

python prepare_dataset.py

which takes care of constructing datasets for training, testing, and visualization. A new folder exclude_{num_exclude}_attacks_version_{version} will be created under the parent folder traces. In this folder, you will find five CSV files

  • validation.csv
  • conflicting_windows.csv
  • pretrain.csv
  • visualization.csv
  • train.csv

Step 3: Model Training

Switch back to the project directory

cd ..

You can train the Window Encoder (Projection BERT) model by executing

python pretrain.py

and train the Message Tagger (LSTM model) model by executing

python train.py

A directory called logs will be automatically created by PyTorch Lightning, and trained models will be saved there.

Step 4: Evaluation and Visualization

You can visualize the embedding space learned by Window Encoder in 2-dim and 3-dim space by executing

python visualization.py

Shortcut

Steps 2 - 4 are implemented in main.py. If you want to automate the training and evaluation process, you can execute

python main.py

instead of going through steps 2-4.

dragon-defender's People

Contributors

ziping-ye avatar

Watchers

 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.