From 56a42333fa9d8b198772eca4fe1550b5a3aecde5 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Sat, 10 Jan 2015 19:32:24 +0100 Subject: [PATCH] Workshop - 5th step added Mapping between malware MD5 and element MD5 added in Redis --- bin/import.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/import.py b/bin/import.py index 2f34479..c15b87b 100644 --- a/bin/import.py +++ b/bin/import.py @@ -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