Skip to content

Commit

Permalink
fix JSON output to return combinations as a dict of unicode represent…
Browse files Browse the repository at this point in the history
…ations and descriptions
  • Loading branch information
glaubermagal committed Nov 14, 2024
1 parent 9ecaaef commit 55fefb6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name='evilurl',
version='2.0.2',
version='2.0.3',
packages=['src'],
package_data={'src': ['unicode_combinations.json']},
setup_requires=['wheel'],
Expand Down
13 changes: 7 additions & 6 deletions src/evilurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def analyze_domain(self, domain):
table_data = []
for index, main_domain_part in enumerate(unique_domains):
full_domain = main_domain_part + '.' + domain_parts.suffix
formatted_combinations = []
punycode_encoded_domain = main_domain_part.encode('idna').decode()
punycode_encoded_full_domain = punycode_encoded_domain + '.' + domain_parts.suffix
if full_domain == punycode_encoded_full_domain:
Expand All @@ -96,22 +95,25 @@ def analyze_domain(self, domain):
if (not dns and self.show_registered_only) or (self.show_mixed_only and not self.is_mixed_domain(punycode_encoded_domain, families)):
continue

combinations_list = []
combinations_dict = {}
for part in main_domain_part:
for char in part:
if char in self.character_descriptions.keys():
formatted_combinations.append(f"{char}{self.character_descriptions.get(char)}")
if char in self.character_descriptions:
combinations_list.append(f"{char}{self.character_descriptions[char]}")
combinations_dict[char] = self.character_descriptions[char]


if self.show_domains_only:
print(full_domain)
continue

combinations_str = "\n".join(formatted_combinations)
table_data.append([
full_domain,
punycode_encoded_full_domain,
dns if dns else 'UNSET',
"YES" if self.is_mixed_domain(punycode_encoded_domain, families) else self.colored_text("NO", 33),
combinations_str
"\n".join(combinations_list) if not self.json_format else combinations_dict
])

if self.json_format:
Expand All @@ -123,7 +125,6 @@ def analyze_domain(self, domain):
if not self.show_domains_only:
print(tabulate(table_data, TABLE_HEADERS, tablefmt="grid"))


def load_unicode_combinations_from_file(file_path):
try:
with open(file_path, 'r') as file:
Expand Down

0 comments on commit 55fefb6

Please sign in to comment.