From bc5b82fa737168ecc34db7d8ae4844731172ab2f Mon Sep 17 00:00:00 2001 From: TheTechromancer Date: Sun, 17 Sep 2023 18:46:05 -0400 Subject: [PATCH] fix NSEC infinite loop bug --- bbot/modules/nsec.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bbot/modules/nsec.py b/bbot/modules/nsec.py index 12c458273..2ab254da7 100644 --- a/bbot/modules/nsec.py +++ b/bbot/modules/nsec.py @@ -33,11 +33,13 @@ async def get_nsec_record(self, domain): self.warning(f"Error getting NSEC record for {domain}: {e}") async def nsec_walk(self, domain): + encountered = set() current_domain = domain while 1: next_domain = await self.get_nsec_record(current_domain) - if next_domain == domain or next_domain is None: + if next_domain is None or next_domain in encountered: break + encountered.add(next_domain) if not next_domain.startswith("\\"): yield next_domain current_domain = next_domain