Skip to content

Commit

Permalink
'new_line' ... not the structure
Browse files Browse the repository at this point in the history
  • Loading branch information
nrathaus committed May 14, 2024
1 parent abdfed9 commit 48c910c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/core/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,26 +145,25 @@ def generate(self, files=[], is_blacklist=False):
final_lines = []
for new_line in new_lines:
# If %DOMAIN% is found, replace it with self.urls (insert as many as they exist)
original_line = new_line['line']
if DOMAIN_TAG in original_line:
if DOMAIN_TAG in new_line:
for hostname in hostnames:
split_hostnames = hostname.split(".")
new_line = original_line.replace(DOMAIN_TAG, hostname)
new_line = new_line.replace(DOMAIN_TAG, hostname)
final_lines.append(new_line)

if len(split_hostnames) > 1:
# We go from 1 dot to .. n .. as we want to return from www.somesite.co.uk:
# www.somesite.co.uk, somesite.co.uk, co.uk
for dots in range(1, len(split_hostnames)):
new_hostname = ".".join(split_hostnames[dots:])
new_line = original_line.replace(DOMAIN_TAG, new_hostname)
new_line = new_line.replace(DOMAIN_TAG, new_hostname)
final_lines.append(new_line)

# We go from n dot to .. 1 .. as we want to return from www.somesite.co.uk:
# www.somesite.co, www.somesite, www
for dots in range(1, len(split_hostnames)):
new_hostname = ".".join(split_hostnames[:dots])
new_line = original_line.replace(DOMAIN_TAG, new_hostname)
new_line = new_line.replace(DOMAIN_TAG, new_hostname)
final_lines.append(new_line)

new_lines = final_lines[:]
Expand Down

0 comments on commit 48c910c

Please sign in to comment.