Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Limit payloads to 63 characters
  • Loading branch information
initstring committed Oct 10, 2023
commit 1c8cab1261eeb0c0b0b4680d5ee2076f00275f56
22 changes: 15 additions & 7 deletions cloud_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ def clean_text(text):
return text_clean


def append_name(name, names_list):
"""
Ensure strings stick to DNS label limit of 63 characters
"""
if len(name) <= 63:
names_list.append(name)


def build_names(base_list, mutations):
"""
Combine base and mutations for processing by individual modules.
Expand All @@ -193,21 +201,21 @@ def build_names(base_list, mutations):
base = clean_text(base)

# First, include with no mutations
names.append(base)
append_name(base, names)

for mutation in mutations:
# Clean mutation
mutation = clean_text(mutation)

# Then, do appends
names.append(f"{base}{mutation}")
names.append(f"{base}.{mutation}")
names.append(f"{base}-{mutation}")
append_name(f"{base}{mutation}", names)
append_name(f"{base}.{mutation}", names)
append_name(f"{base}-{mutation}", names)

# Then, do prepends
names.append(f"{mutation}{base}")
names.append(f"{mutation}.{base}")
names.append(f"{mutation}-{base}")
append_name(f"{mutation}{base}", names)
append_name(f"{mutation}.{base}", names)
append_name(f"{mutation}-{base}", names)

print(f"[+] Mutated results: {len(names)} items")

Expand Down