mirror of https://github.com/D4-project/d4-core
Worker 2 pushes to analyzer's redis
parent
bb09272e64
commit
8b74c98396
|
@ -16,6 +16,29 @@ ROTATION_SAVE_CYCLE = 300 # seconds
|
||||||
MAX_BUFFER_LENGTH = 100000
|
MAX_BUFFER_LENGTH = 100000
|
||||||
TYPE = 254
|
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:
|
class MetaTypesDefault:
|
||||||
|
|
||||||
def __init__(self, uuid, json_file):
|
def __init__(self, uuid, json_file):
|
||||||
|
|
|
@ -8,6 +8,7 @@ import redis
|
||||||
import datetime
|
import datetime
|
||||||
import hashlib
|
import hashlib
|
||||||
import binascii
|
import binascii
|
||||||
|
import redis
|
||||||
import pdb
|
import pdb
|
||||||
|
|
||||||
from meta_types_modules.MetaTypesDefault import MetaTypesDefault
|
from meta_types_modules.MetaTypesDefault import MetaTypesDefault
|
||||||
|
@ -39,7 +40,7 @@ class TypeHandler(MetaTypesDefault):
|
||||||
cert = binascii.a2b_base64(certificate["Raw"])
|
cert = binascii.a2b_base64(certificate["Raw"])
|
||||||
# one could also load this cert with
|
# one could also load this cert with
|
||||||
# xcert = x509.load_der_x509_certificate(cert, default_backend())
|
# xcert = x509.load_der_x509_certificate(cert, default_backend())
|
||||||
m = hashlib.sha256()
|
m = hashlib.sha1()
|
||||||
m.update(cert)
|
m.update(cert)
|
||||||
cert_path = os.path.join(cert_save_dir, m.hexdigest()+'.crt')
|
cert_path = os.path.join(cert_save_dir, m.hexdigest()+'.crt')
|
||||||
# write unique certificate der file to disk
|
# 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')
|
jsons_path = os.path.join(jsons_save_dir, mtjson["Timestamp"]+'.json')
|
||||||
with open(jsons_path, 'w') as j:
|
with open(jsons_path, 'w') as j:
|
||||||
j.write(data.decode())
|
j.write(data.decode())
|
||||||
|
# Send data to Analyszer
|
||||||
|
self.send_to_analyzers(jsons_path)
|
||||||
|
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
print('Class: ja3-jl')
|
print('Class: ja3-jl')
|
||||||
|
|
Loading…
Reference in New Issue