From 78f90d5c2ab65f3a977a20117ed3aad3165eb293 Mon Sep 17 00:00:00 2001 From: Mohammed Wazir Adain Date: Fri, 22 Nov 2024 21:48:19 -0500 Subject: [PATCH 1/3] add timestamp and CN in CSV log entries --- axeman/core.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/axeman/core.py b/axeman/core.py index d67a4c2..22a56e8 100644 --- a/axeman/core.py +++ b/axeman/core.py @@ -195,6 +195,11 @@ def process_worker(result_info): crypto.load_certificate(crypto.FILETYPE_ASN1, cert.CertData) ) + cert_data['timestamp'] = "" + + if mtl.Timestamp: + cert_data['timestamp'] = mtl.Timestamp + cert_data.update({ "leaf_cert": certlib.dump_cert(chain[0]), "chain": [certlib.dump_cert(x) for x in chain[1:]] @@ -208,14 +213,16 @@ def process_worker(result_info): chain_hash = hashlib.sha256("".join([x['as_der'] for x in cert_data['chain']]).encode('ascii')).hexdigest() - # header = "url, cert_index, chain_hash, cert_der, all_domains, not_before, not_after" + # header = "timestamp, url, cert_index, chain_hash, cert_der, all_domains, CN, not_before, not_after" lines.append( ",".join([ + cert_data['timestamp'], result_info['log_info']['url'], str(entry['cert_index']), chain_hash, cert_data['leaf_cert']['as_der'], ' '.join(cert_data['leaf_cert']['all_domains']), + cert_data['leaf_cert']['subject']['CN'], str(cert_data['leaf_cert']['not_before']), str(cert_data['leaf_cert']['not_after']) ]) + "\n" From f81228153a10a261b23cfba52a9705dddc351cc9 Mon Sep 17 00:00:00 2001 From: Mohammed Wazir Adain Date: Fri, 22 Nov 2024 21:59:59 -0500 Subject: [PATCH 2/3] parse timestamp to str --- axeman/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/axeman/core.py b/axeman/core.py index 22a56e8..a58a1d5 100644 --- a/axeman/core.py +++ b/axeman/core.py @@ -216,7 +216,7 @@ def process_worker(result_info): # header = "timestamp, url, cert_index, chain_hash, cert_der, all_domains, CN, not_before, not_after" lines.append( ",".join([ - cert_data['timestamp'], + str(cert_data['timestamp']), result_info['log_info']['url'], str(entry['cert_index']), chain_hash, From 5fc84a327b5b9b22174faae1508ce115aaabe7e0 Mon Sep 17 00:00:00 2001 From: Mohammed Wazir Adain Date: Fri, 22 Nov 2024 22:09:09 -0500 Subject: [PATCH 3/3] get rid of chain_hash, cert_der in CSV headers --- axeman/core.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/axeman/core.py b/axeman/core.py index a58a1d5..d521a6a 100644 --- a/axeman/core.py +++ b/axeman/core.py @@ -213,14 +213,15 @@ def process_worker(result_info): chain_hash = hashlib.sha256("".join([x['as_der'] for x in cert_data['chain']]).encode('ascii')).hexdigest() - # header = "timestamp, url, cert_index, chain_hash, cert_der, all_domains, CN, not_before, not_after" + # NOT USED, this was the header earlier header = "url, cert_index, chain_hash, cert_der, all_domains, not_before, not_after" + # header = "timestamp, url, cert_index, all_domains, CN, not_before, not_after" lines.append( ",".join([ str(cert_data['timestamp']), result_info['log_info']['url'], str(entry['cert_index']), - chain_hash, - cert_data['leaf_cert']['as_der'], + # chain_hash, + # cert_data['leaf_cert']['as_der'], ' '.join(cert_data['leaf_cert']['all_domains']), cert_data['leaf_cert']['subject']['CN'], str(cert_data['leaf_cert']['not_before']),