From 738bc22cf3ebe8f194a2cbffdab9aeedd367364a Mon Sep 17 00:00:00 2001 From: Mohammed Wazir Adain Date: Sat, 23 Nov 2024 02:50:04 -0500 Subject: [PATCH] get rid of construct.Embedded to support python version >3.11 --- axeman/certlib.py | 4 ++-- axeman/core.py | 4 ++-- requirements.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/axeman/certlib.py b/axeman/certlib.py index 47b872a..4c809b0 100644 --- a/axeman/certlib.py +++ b/axeman/certlib.py @@ -12,7 +12,7 @@ DOWNLOAD = "https://{}/ct/v1/get-entries?start={}&end={}" -from construct import Struct, Byte, Int16ub, Int64ub, Enum, Bytes, Int24ub, this, GreedyBytes, GreedyRange, Terminated, Embedded +from construct import Struct, Byte, Int16ub, Int64ub, Enum, Bytes, Int24ub, this, GreedyBytes, GreedyRange, Terminated MerkleTreeHeader = Struct( "Version" / Byte, @@ -34,7 +34,7 @@ PreCertEntry = Struct( "LeafCert" / Certificate, - Embedded(CertificateChain), + "CertificateChain" / CertificateChain, Terminated ) diff --git a/axeman/core.py b/axeman/core.py index d67a4c2..075a6c7 100644 --- a/axeman/core.py +++ b/axeman/core.py @@ -190,7 +190,7 @@ def process_worker(result_info): extra_data = certlib.PreCertEntry.parse(base64.b64decode(entry['extra_data'])) chain = [crypto.load_certificate(crypto.FILETYPE_ASN1, extra_data.LeafCert.CertData)] - for cert in extra_data.Chain: + for cert in extra_data.CertificateChain.Chain: chain.append( crypto.load_certificate(crypto.FILETYPE_ASN1, cert.CertData) ) @@ -248,7 +248,7 @@ async def get_certs_and_print(): print(log['description']) print(" \- URL: {}".format(log['url'])) print(" \- Owner: {}".format(log_info['operated_by'])) - print(" \- Cert Count: {}".format(locale.format("%d", log_info['tree_size']-1, grouping=True))) + print(" \- Cert Count: {}".format(locale.format_string("%d", log_info['tree_size']-1, grouping=True))) print(" \- Max Block Size: {}\n".format(log_info['block_size'])) def main(): diff --git a/requirements.txt b/requirements.txt index ff201bf..21b3a82 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,4 @@ uvloop aiohttp aioprocessing PyOpenSSL -construct==2.9.52 +construct