mirror of
https://github.com/domainaware/parsedmarc.git
synced 2026-02-17 07:03:58 +00:00
Fix find_unknown_base_reverse_dns.py and sortlist.py
This commit is contained in:
@@ -724,7 +724,6 @@ ip-51-89-240.eu,OVH,Web Host
|
||||
ip-87-98-138.eu,OVH,Web Host
|
||||
ip-92-204-129.us,OVH,Web Host
|
||||
ip-92-204-134.us,OVH,Web Host
|
||||
ip-92-204-134.us,OVH,Web Host
|
||||
iphmx.com,Cisco Cloud Email Security (CES),Email Security
|
||||
iphotel.net.br,IPHOTEL Hosped,Web Host
|
||||
iphouse.net,Sandwich,Web Host
|
||||
|
||||
|
@@ -24,7 +24,6 @@ def _main():
|
||||
if not os.path.exists(file_path):
|
||||
print(f"Error: {file_path} does not exist")
|
||||
print(f"Loading {file_path}")
|
||||
list_var = []
|
||||
with open(file_path) as f:
|
||||
for line in f.readlines():
|
||||
domain = line.lower().strip()
|
||||
@@ -36,6 +35,25 @@ def _main():
|
||||
|
||||
load_list(known_unknown_list_file_path, known_unknown_domains)
|
||||
load_list(psl_overrides_file_path, psl_overrides)
|
||||
if not os.path.exists(base_reverse_dns_map_file_path):
|
||||
print(f"Error: {base_reverse_dns_map_file_path} does not exist")
|
||||
print(f"Loading {base_reverse_dns_map_file_path}")
|
||||
with open(base_reverse_dns_map_file_path) as f:
|
||||
for row in csv.DictReader(f):
|
||||
domain = row["base_reverse_dns"].lower().strip()
|
||||
if domain in known_domains:
|
||||
print(
|
||||
f"Error: {domain} is in {base_reverse_dns_map_file_path} multiple times"
|
||||
)
|
||||
exit()
|
||||
else:
|
||||
known_domains.append(domain)
|
||||
if domain in known_unknown_domains and known_domains:
|
||||
print(
|
||||
f"Error:{domain} is in {known_unknown_list_file_path} and \
|
||||
{base_reverse_dns_map_file_path}"
|
||||
)
|
||||
exit(1)
|
||||
if not os.path.exists(input_csv_file_path):
|
||||
print(f"Error: {input_csv_file_path} does not exist")
|
||||
exit(1)
|
||||
|
||||
@@ -70,9 +70,9 @@ def sort_csv(
|
||||
) -> None:
|
||||
if sort_field_value_must_be_unique:
|
||||
if row[sort_field] in seen_sort_field_values:
|
||||
errors.append(f"Line {line_no}: Duplicate row for '{sort_field}'")
|
||||
errors.append(f"Line {line_no}: Duplicate row for '{row[sort_field]}'")
|
||||
else:
|
||||
seen_sort_field_values.append(sort_field)
|
||||
seen_sort_field_values.append(row[sort_field])
|
||||
for rf in required_fields:
|
||||
val = row.get(rf)
|
||||
if val is None or val == "":
|
||||
|
||||
Reference in New Issue
Block a user