mirror of https://github.com/D4-project/d4-core
chg: [worker2 ja3] add debug
parent
e4e4d8d57e
commit
0816a93efe
|
@ -38,27 +38,29 @@ class TypeHandler(MetaTypesDefault):
|
||||||
# Extract certificates from json
|
# Extract certificates from json
|
||||||
try:
|
try:
|
||||||
mtjson = json.loads(decoded_data)
|
mtjson = json.loads(decoded_data)
|
||||||
|
res = True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(decoded_data)
|
print(decoded_data)
|
||||||
continue
|
res = False
|
||||||
#mtjson = json.loads(decoded_data)
|
if res:
|
||||||
for certificate in mtjson["Certificates"] or []:
|
#mtjson = json.loads(decoded_data)
|
||||||
cert = binascii.a2b_base64(certificate["Raw"])
|
for certificate in mtjson["Certificates"] or []:
|
||||||
# one could also load this cert with
|
cert = binascii.a2b_base64(certificate["Raw"])
|
||||||
# xcert = x509.load_der_x509_certificate(cert, default_backend())
|
# one could also load this cert with
|
||||||
m = hashlib.sha1()
|
# xcert = x509.load_der_x509_certificate(cert, default_backend())
|
||||||
m.update(cert)
|
m = hashlib.sha1()
|
||||||
cert_path = os.path.join(cert_save_dir, m.hexdigest()+'.crt')
|
m.update(cert)
|
||||||
# write unique certificate der file to disk
|
cert_path = os.path.join(cert_save_dir, m.hexdigest()+'.crt')
|
||||||
with open(cert_path, 'w+b') as c:
|
# write unique certificate der file to disk
|
||||||
c.write(cert)
|
with open(cert_path, 'w+b') as c:
|
||||||
|
c.write(cert)
|
||||||
|
|
||||||
# write json file to disk
|
# write json file to disk
|
||||||
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(decoded_data)
|
j.write(decoded_data)
|
||||||
# Send data to Analyszer
|
# Send data to Analyszer
|
||||||
self.send_to_analyzers(jsons_path)
|
self.send_to_analyzers(jsons_path)
|
||||||
|
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
|
|
Loading…
Reference in New Issue