From: Roland Häder Date: Wed, 21 Jun 2023 04:17:39 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3f0a7254b925ad2e50be7ed189dba4315925b73a;p=fba.git Continued: - skip bad domains here, too - this avoids more exceptions --- diff --git a/fba/commands.py b/fba/commands.py index 277a1b7..ae79e81 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -260,7 +260,10 @@ def fetch_blocks(args: argparse.Namespace): print(f"WARNING: blocked='{blocked}',software='{software}' is not a valid domain name - SKIPPED!") continue elif blocked.endswith(".arpa"): - # DEBUG: print(f"DEBUG: blocked='{blocked}' is ending with '.arpa' - SKIPPED!") + # DEBUG: print(f"DEBUG: blocked='{blocked}' is a reverse IP domain - SKIPPED!") + continue + elif blocked.endswith(".tld"): + # DEBUG: print(f"DEBUG: blocked='{blocked}' is a fake domain - SKIPPED!") continue elif not instances.is_registered(blocked): # DEBUG: print("DEBUG: Hash wasn't found, adding:", blocked, blocker) @@ -680,6 +683,19 @@ def fetch_oliphant(args: argparse.Namespace): # DEBUG: print(f"DEBUG: row='{row}' does not contain domain column") continue + if not validators.domain(domain): + print(f"WARNING: domain='{domain}' is not a valid domain name - SKIPPED!") + continue + elif domain.endswith(".arpa"): + # DEBUG: print(f"DEBUG: domain='{domain}' is a reverse IP domain - SKIPPED!") + continue + elif domain.endswith(".tld"): + # DEBUG: print(f"DEBUG: domain='{domain}' is a fake domain - SKIPPED!") + continue + elif blacklist.is_blacklisted(domain): + # DEBUG: print(f"DEBUG: domain='{domain}' is blacklisted - SKIPPED!") + continue + # DEBUG: print(f"DEBUG: Marking domain='{domain}' as handled") domains.append(domain) @@ -711,7 +727,21 @@ def fetch_txt(args: argparse.Namespace): print(f"INFO: Processing {len(domains)} domains ...") for domain in domains: + # DEBUG: print(f"DEBUG: domain='{domain}'") if domain == "": + # DEBUG: print("DEBUG: domain is empty - SKIPPED!") + continue + elif not validators.domain(domain): + print(f"WARNING: domain='{domain}' is not a valid domain name - SKIPPED!") + continue + elif domain.endswith(".arpa"): + # DEBUG: print(f"DEBUG: domain='{domain}' is a reverse IP domain - SKIPPED!") + continue + elif domain.endswith(".tld"): + # DEBUG: print(f"DEBUG: domain='{domain}' is a fake domain - SKIPPED!") + continue + elif blacklist.is_blacklisted(domain): + # DEBUG: print(f"DEBUG: domain='{domain}' is blacklisted - SKIPPED!") continue # DEBUG: print(f"DEBUG: domain='{domain}'")