Skip to content

Commit

Permalink
Merge pull request #737 from blacklanternsecurity/nsec-fix
Browse files Browse the repository at this point in the history
Fix NSEC Infinite Loop Bug
  • Loading branch information
TheTechromancer authored Sep 18, 2023
2 parents 641eec4 + bc5b82f commit e381ed2
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 e381ed2

Please sign in to comment.