Workshop - 5th step added

Mapping between malware MD5 and element MD5 added in Redis
This commit is contained in:
Alexandre Dulaunoy 2015-01-10 19:32:24 +01:00
parent 3b1ca45d06
commit 56a42333fa

View file

@ -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