Skip to content

Commit

Permalink
fix NSEC infinite loop bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechromancer committed Sep 17, 2023
1 parent ba4fc61 commit bc5b82f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bbot/modules/nsec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit bc5b82f

Please sign in to comment.