Adversarial Robustness with Non-uniform Perturbations

Overview

Adversarial Robustness with Non-uniform Perturbations

This repository hosts the code to replicate experiments of the paper Adversarial Robustness with Non-uniform Perturbations for malware use-case.

Installation

Please first refer to https://github.com/elastic/ember and follow the instructions to download 2018 version of EMBER dataset and install ember package.

After installing ember, use pip to install the required packages for this project:

pip install -r requirements.txt

Usage

NonuniformRobustness.py

This file contains the following functions:

  • get_clean_data(data_dir) returns train and test sets of vectorized EMBER dataset features

  • get_adversarial_examples(data_dir, num_features, attack_name="GreedyNN") returns adversarial example set which is crafted by the specified problem space attack, e.g., Greedy attack (GreedyNN).

  • omega(num_features, perturbation_constraint="Uniform") computes the matrix Omega which is used in l2 PGD algorithm as a coefficient of delta perturbation constraint. Constraint type can be selected as "Uniform", "Pearson", "SHAP","Masked","Mahalanobis" and "Mahalanobis benign".

  • pgd_l2(model, X, y, config) returns delta perturbations to be added to training data during adversarial training. l2 PGD algorithm is applied according to the given configurations which contain omega matrix of previously selected perturbation_constraint.

  • get_trained_model returns adversarially trained model with l2 PGD algorithm and prints test performance on clean data and adversarial examples

Malware_demo.ipynb

Contains a demo of adversarial training a model with specified perturbation constraints. Clean accuracy on test set and defense success on adversarial examples are tested.

nonuniform_omega

Contains necessary data for Omega matrix calculation such as Pearson correlation coefficients, Shapley values, covariance matrix of the training set to calculate Mahalanobis distance and covariance matrix of only benign class for Mahalanobis benign.

Adversarial_example_sets

Contains the adversarial example sets generated by the winner attacks of malware evasion competition 2019.

This suite consists of two different scripts, made to automate attacks against NoSQL databases.

NoSQL-Attack-Suite This suite consists of two different scripts, made to automate attacks against NoSQL databases. The first one looks for a NoSQL Aut

16 Dec 26, 2022
Open Source defrag's mod code

Open Source defrag's mod code Goals: Code & License: Respect FOSS philosophy. Open source and community focus. Eliminate all traces of q3a-sdk licensi

sOkam! 1 Dec 10, 2022
TinyBar - Tiny MacOS menu bar utility to track price dynamics for assets on TinyMan.org

📃 About A simple MacOS menu bar app to display current coins from most popular Liquidity Pools on TinyMan.org

Al 8 Dec 23, 2022
An Advent calendar of small programming puzzles for a variety of skill sets and skill levels.

Advent of Code 2021 The Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be sol

Evan Cope 0 Feb 13, 2022
Results of Robot Framework 5.0 survey

Robot Framework 5.0 survey results We had a survey asking what features Robot Framework community members would like to see in the forthcoming Robot F

Pekka KlÀrck 2 Oct 16, 2021
Decoupled Smoothing in Probabilistic Soft Logic

Decoupled Smoothing in Probabilistic Soft Logic Experiments for "Decoupled Smoothing in Probabilistic Soft Logic". Probabilistic Soft Logic Probabilis

Kushal Shingote 1 Feb 08, 2022
Python Script to add OpenGapps, Magisk, libhoudini translation library and libndk translation library to waydroid !

Waydroid Extras Script Script to add gapps and other stuff to waydroid ! Installation/Usage "lzip" is required for this script to work, install it usi

Casu Al Snek 331 Jan 02, 2023
Projeto de Jogo de dados em Python 3 onde Ă© definido o lado a ser apostado e nĂșmero de jogadas, pontuando os acertos e exibindo se ganhou ou perdeu.

Jogo de DadoX Projeto de script que simula um Jogo de dados em Python 3 onde Ă© definido o lado a ser apostado (1, 2, 3, 4, 5 e 6) ou se vai ser um nĂșm

EstĂȘnio Mariano 1 Jul 10, 2021
Decipher using Markov Chain Monte Carlo

Decipher using Markov Chain Monte Carlo

Science Ă©tonnante 43 Dec 24, 2022
Python most simple|stupid programming language (MSPL)

Most Simple|Stupid Programming language. (MSPL) Stack - Based programming language "written in Python" Features: Interpretate code (Run). Generate gra

Kirill Zhosul 14 Nov 03, 2022
A 3D Slicer Extension to view data from the flywheel heirarchy

flywheel-connect A 3D Slicer Extension to view, select, and download images from a Flywheel instance to 3D Slicer and storing Slicer outputs back to F

4 Nov 05, 2022
Dyson Sphere Program Blueprint Toolkit

dspbptk This is dspbptk, the Dyson Sphere Program Blueprint toolkit. Dyson Sphere Program is an amazing factory-building game by the incredibly talent

Johannes Bauer 22 Nov 15, 2022
Schemdule is a tiny tool using script as schema to schedule one day and remind you to do something during a day.

Schemdule is a tiny tool using script as schema to schedule one day and remind you to do something during a day. Platform Python Install Use pip: pip

StardustDL 4 Sep 13, 2021
Probably the best way to simulate block scopes in Python

This is a package, as it says on the tin, to emulate block scoping in Python, the lack of which being a clever design choice yet sometimes a trouble.

88 Oct 26, 2022
- Auto join teams teams ( from calendar invite )

Auto Join Teams Meetings Requirements: Python 3.7 or higher Latest Google Chrome This script automatically logins to your account and joins the meetin

Prajin Khadka 10 Aug 20, 2022
python scripts to perform coin die clustering (performed on Riedones3D).

python scripts to perform coin die clustering (performed on Riedones3D).

Sofiane 2 Apr 29, 2022
Add your recently blog and douban states in your GitHub Profile

Add your recently blog and douban states in your GitHub Profile

Bingjie Yan 4 Dec 12, 2022
Handwrite - Type in your Handwriting!

Handwrite - Type in your Handwriting! Ever had those long-winded assignments, that the teacher always wants handwritten?

coded 7 Dec 06, 2022
CountdownTimer - Countdown Timer For Python

Countdown Timer This python script asks for the user time (input) in seconds, an

Arinzechukwu Okoye 1 Jan 01, 2022
The goal of this program was to find the most common color in my living room.

The goal of this program was to find the most common color in my living room. I found a dataset online with colors names and their corr

1 Nov 09, 2021