Skip to content

Commit

Permalink
cache yara regexes
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Sep 3, 2024
1 parent dd70fa1 commit ecac174
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bbot/scanner/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ def __init__(

self._dns_strings = None
self._dns_regexes = None
self._dns_regexes_yara = None

self.__log_handlers = None
self._log_handler_backup = []
Expand Down Expand Up @@ -1000,7 +1001,7 @@ def dns_regexes(self):
... for match in regex.finditer(response.text):
... hostname = match.group().lower()
"""
if not self._dns_regexes:
if self._dns_regexes is None:
self._dns_regexes = self._generate_dns_regexes(r"((?:(?:[\w-]+)\.)+")
return self._dns_regexes

Expand All @@ -1009,7 +1010,9 @@ def dns_regexes_yara(self):
"""
Returns a list of DNS hostname regexes formatted specifically for compatibility with YARA rules.
"""
return self._generate_dns_regexes(r"(([a-z0-9-]+\.)+")
if self._dns_regexes_yara is None:
self._dns_regexes_yara = self._generate_dns_regexes(r"(([a-z0-9-]+\.)+")
return self._dns_regexes_yara

@property
def json(self):
Expand Down

0 comments on commit ecac174

Please sign in to comment.