Worker 2 pushes to analyzer's redis

pull/23/head
Jean-Louis Huynen 2019-03-27 11:09:45 +01:00
parent bb09272e64
commit 8b74c98396
No known key found for this signature in database
GPG Key ID: 4CDEBABACE9A5DC9
2 changed files with 28 additions and 1 deletions

View File

@ -16,6 +16,29 @@ ROTATION_SAVE_CYCLE = 300 # seconds
MAX_BUFFER_LENGTH = 100000
TYPE = 254
host_redis_stream = "localhost"
port_redis_stream = 6379
redis_server_stream = redis.StrictRedis(
host=host_redis_stream,
port=port_redis_stream,
db=0)
host_redis_metadata = "localhost"
port_redis_metadata = 6380
redis_server_metadata = redis.StrictRedis(
host=host_redis_metadata,
port=port_redis_metadata,
db=0)
redis_server_analyzer = redis.StrictRedis(
host=host_redis_metadata,
port=port_redis_metadata,
db=2)
analyzer_list_max_default_size = 10000
class MetaTypesDefault:
def __init__(self, uuid, json_file):

View File

@ -8,6 +8,7 @@ import redis
import datetime
import hashlib
import binascii
import redis
import pdb
from meta_types_modules.MetaTypesDefault import MetaTypesDefault
@ -39,7 +40,7 @@ class TypeHandler(MetaTypesDefault):
cert = binascii.a2b_base64(certificate["Raw"])
# one could also load this cert with
# xcert = x509.load_der_x509_certificate(cert, default_backend())
m = hashlib.sha256()
m = hashlib.sha1()
m.update(cert)
cert_path = os.path.join(cert_save_dir, m.hexdigest()+'.crt')
# write unique certificate der file to disk
@ -50,6 +51,9 @@ class TypeHandler(MetaTypesDefault):
jsons_path = os.path.join(jsons_save_dir, mtjson["Timestamp"]+'.json')
with open(jsons_path, 'w') as j:
j.write(data.decode())
# Send data to Analyszer
self.send_to_analyzers(jsons_path)
def test(self):
print('Class: ja3-jl')