From 8d7b56b464353155c0798055c7c28a9f3e0fccee Mon Sep 17 00:00:00 2001 From: Leron Gray Date: Fri, 15 Jul 2022 07:32:39 -0700 Subject: [PATCH] fix empty x509 list --- dumpscan/common/scanners/x509.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dumpscan/common/scanners/x509.py b/dumpscan/common/scanners/x509.py index ec0af60..f90292b 100644 --- a/dumpscan/common/scanners/x509.py +++ b/dumpscan/common/scanners/x509.py @@ -1,6 +1,5 @@ import binascii from base64 import b64encode -from collections import defaultdict from pathlib import Path from struct import unpack @@ -34,7 +33,7 @@ def __init__(self, minidumpfile: MinidumpFile, output: Path) -> None: self.rules = yara.compile(sources=YARA_RULES["x509"]) self.dump = minidumpfile self.output = output - self.matching_objects = defaultdict(list) + self.matching_objects = {"x509": [], "pkcs": []} self.modulus_dict = {} self.public_private_matches = {} self.current_section: MINIDUMP_MEMORY_DESCRIPTOR64 = None @@ -116,7 +115,7 @@ def minidump_scan(cls, minidumpfile: MinidumpFile, output: Path) -> "x509Scanner ) scanner.modulus_dict = {} - for cert in scanner.matching_objects.get("x509"): + for cert in scanner.matching_objects.get("x509", []): public_key = cert.public_key() if isinstance(public_key, RSAPublicKey):