MalwareClassifier/bin/import.py
Alexandre Dulaunoy a7f73154b0 Workshop - third step
Import tshark parsing headers in Redis
2015-01-10 19:25:07 +01:00

21 lines
569 B
Python

import argparse
import sys
import redis
argParser = argparse.ArgumentParser(description='Malware classifier')
argParser.add_argument('-f', action='append', help='Filename')
args = argParser.parse_args()
r = redis.StrictRedis(host='localhost', port=6379, db=0)
if args.f is not None:
md5 = args.f[0].split(".")[0]
r.sadd('processed', md5)
lnumber = 0
for line in sys.stdin:
if lnumber == 0:
for field in line.rstrip().split(","):
r.sadd('type', field)
lnumber = lnumber + 1
else:
argParser.print_help()