November 2019
Intermediate to advanced
346 pages
9h 36m
English
In the following steps, we will demonstrate how the hash-gram algorithm works:
from os import listdirfrom nltk import ngramsimport hashlibdirectories = ["Benign PE Samples", "Malicious PE Samples"]N = 2
def read_file(file_path): """Reads in the binary sequence of a binary file.""" with open(file_path, "rb") as binary_file: data = binary_file.read() return datadef byte_sequence_to_Ngrams(byte_sequence, N): """Creates a list of N-grams from a byte sequence.""" return ngrams(byte_sequence, ...