]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 21 Jun 2023 04:17:39 +0000 (06:17 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 21 Jun 2023 04:17:39 +0000 (06:17 +0200)
- skip bad domains here, too
- this avoids more exceptions

fba/commands.py

index 277a1b79a19ec4258f7e8a84514c818e7bc30f3d..ae79e8197824bd5e35250cb72bb43bb974adad4b 100644 (file)
@@ -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}'")