Skip to content

Commit

Permalink
optimize generate_templist
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidsec committed Aug 24, 2024
1 parent 0e1c426 commit 696ab91
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions bbot/modules/deadly/ffuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,18 +312,29 @@ async def execute_ffuf(

def generate_templist(self, prefix=None):
line_count = 0

virtual_file = []

if prefix:
prefix = prefix.strip().lower()

max_lines = self.config.get("lines")
banned_set = set(self.banned_characters)

for idx, val in enumerate(self.wordlist_lines):
if idx > self.config.get("lines"):
if idx > max_lines:
break
if len(val) > 0:
if val.strip().lower() in self.blacklist:
self.debug(f"Skipping adding [{val.strip()}] to wordlist because it was in the blacklist")
stripped_val = val.strip().lower()
if stripped_val:
# Check if the word is in the blacklist
if stripped_val in self.blacklist:
self.debug(f"Skipping adding [{stripped_val}] to wordlist because it was in the blacklist")
else:
if not prefix or val.strip().lower().startswith(prefix.strip().lower()):
if not any(char in val.strip().lower() for char in self.banned_characters):
# Check if it starts with the given prefix (if any)
if not prefix or stripped_val.startswith(prefix):
# Check if it contains any banned characters
if not any(char in banned_set for char in stripped_val):
line_count += 1
virtual_file.append(f"{val.strip().lower()}")
virtual_file.append(stripped_val)

virtual_file.append(self.canary)
return self.helpers.tempfile(virtual_file, pipe=False), line_count

0 comments on commit 696ab91

Please sign in to comment.