From 84edd62b28ac02b06b8f2387a73b56925732adfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 1 Oct 2024 21:42:14 +0200 Subject: [PATCH] fix: Avoid exception on broken MX --- lookyloo/capturecache.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lookyloo/capturecache.py b/lookyloo/capturecache.py index 823c0740..409a6d42 100644 --- a/lookyloo/capturecache.py +++ b/lookyloo/capturecache.py @@ -665,7 +665,10 @@ class CapturesIndex(Mapping): # type: ignore[type-arg] name_to_cache = str(answer.name).rstrip('.') if name_to_cache not in host_mx: host_mx[name_to_cache] = set() - host_mx[name_to_cache] |= {str(b.exchange) for b in answer} + try: + host_mx[name_to_cache] |= {str(b.exchange) for b in answer} + except Exception as e: + logger.warning(f'[MX record] broken: {e}') try: ns_response = await self.dnsresolver.resolve(node.name, dns.rdatatype.RdataType.NS, search=True, raise_on_no_answer=True)