In this recipe, you will learn how to create adversarial malware:
- Begin by importing the code for MalGAN, as well as some utility libraries.
import osimport pandas as pdfrom keras.models import load_modelimport MalGAN_utilsimport MalGAN_gen_adv_examples
- Specify the input and output paths:
save_path = "MalGAN_output"model_path = "MalGAN_input/malconv.h5"log_path = "MalGAN_output/adversarial_log.csv"pad_percent = 0.1threshold = 0.6step_size = 0.01limit = 0.input_samples = "MalGAN_input/samplesIn.csv"
- Set whether you'd like to use a GPU for adversarial sample generation:
MalGAN_utils.limit_gpu_memory(limit)
- Read in the csv file containing the names and labels of your samples into a data frame:
df = pd.read_csv(input_samples, ...