-
Notifications
You must be signed in to change notification settings - Fork 17
/
extract_gist_features.py
39 lines (33 loc) · 1.28 KB
/
extract_gist_features.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import argparse
from library.utils import Utils
import numpy
import os
import time
import shutil
import sys
def main(arguments=None):
# Argument parsing
parser = argparse.ArgumentParser(
description='Calculates the GIST features from a directory of files.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('MalwareDirectory',
help='The directory containing malware to analyze.')
parser.add_argument('DataDirectory',
help='The directory that will contain the data files.')
parser.add_argument("-j", "--jobs", type=int, default=1,
help="The number of jobs to do the work, but be 1 or greater."
"", required=False)
if isinstance(arguments, list):
args = parser.parse_args(arguments)
else:
args = parser.parse_args()
if args.jobs < 1:
print("Jobs must be 1 or greater.")
exit()
# Crawl the directories for malware and calculate rwe
Utils.extract_gist_features_from_directory(args.MalwareDirectory,
args.DataDirectory,
njobs=args.jobs)
if __name__ == "__main__":
args = sys.argv[1:]
main(args)