mirror of
https://github.com/adulau/MalwareClassifier.git
synced 2024-12-22 00:36:00 +00:00
Workshop - 5th step added
Mapping between malware MD5 and element MD5 added in Redis
This commit is contained in:
parent
3b1ca45d06
commit
56a42333fa
1 changed files with 7 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
import argparse
|
||||
import sys
|
||||
import redis
|
||||
import hashlib
|
||||
|
||||
argParser = argparse.ArgumentParser(description='Malware classifier')
|
||||
argParser.add_argument('-f', action='append', help='Filename')
|
||||
|
@ -24,6 +25,12 @@ if args.f is not None:
|
|||
for element in elements:
|
||||
try:
|
||||
r.sadd('e:'+fields[i], element)
|
||||
#
|
||||
ehash = hashlib.md5()
|
||||
ehash.update(element.encode('utf-8'))
|
||||
ehhex = ehash.hexdigest()
|
||||
if element is not "":
|
||||
r.sadd('v:'+ehhex, md5)
|
||||
except IndexError:
|
||||
print("Empty fields")
|
||||
i = i+1
|
||||
|
|
Loading…
Reference in a new issue