]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 24 Jun 2023 07:39:12 +0000 (09:39 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 24 Jun 2023 07:39:12 +0000 (09:39 +0200)
- check if domain is wanted before trying to deobfuscate it

fba/networks/pleroma.py

index 84a535fee0adf4e0597327a09d39ca50a20c2266..f8fb931f9c8f69c628eac9a661bc1ccc364818e1 100644 (file)
@@ -109,11 +109,8 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list:
                     if blocked == "":
                         logger.warning("blocked is empty after tidyup.domain(): domain='%s',block_level='%s'", domain, block_level)
                         continue
-                    elif blocked.endswith(".arpa"):
-                        logger.debug("blocked='%s' is a reverse IP address - SKIPPED!", blocked)
-                        continue
-                    elif blocked.endswith(".tld"):
-                        logger.debug("blocked='%s' is a fake domain - SKIPPED!", blocked)
+                    elif not utils.is_domain_wanted(blocked):
+                        logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
                         continue
 
                     logger.debug("Invoking utils.deobfuscate_domain(%s, %s) ...", blocked, domain)
@@ -145,11 +142,8 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list:
             if blocked == "":
                 logger.warning("blocked is empty after tidyup.domain(): domain='%s',block_level='%s'", domain, block_level)
                 continue
-            elif blocked.endswith(".arpa"):
-                logger.debug("blocked='%s' is a reverse IP address - SKIPPED!", blocked)
-                continue
-            elif blocked.endswith(".tld"):
-                logger.debug("blocked='%s' is a fake domain - SKIPPED!", blocked)
+            elif not utils.is_domain_wanted(blocked):
+                logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
                 continue
 
             logger.debug("Invoking utils.deobfuscate_domain(%s, %s) ...", blocked, domain)
@@ -221,14 +215,13 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list:
                 if blocked == "":
                     logger.warning("blocked is empty after tidyup.domain(): domain='%s',block_level='%s'", domain, block_level)
                     continue
+                elif not utils.is_domain_wanted(blocked):
+                    logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
+                    continue
 
                 logger.debug("Invoking utils.deobfuscate_domain(%s, %s) ...", blocked, domain)
                 blocked = utils.deobfuscate_domain(blocked, domain)
-
                 logger.debug("blocked='%s' - DEOBFUSCATED!", blocked)
-                if not utils.is_domain_wanted(blocked):
-                    logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
-                    continue
 
                 logger.debug("Checking %d blockdict records ...", len(blockdict))
                 for block in blockdict:
@@ -298,14 +291,13 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list:
                     if blocked == "":
                         logger.warning("blocked is empty after tidyup.domain(): domain='%s',block_level='%s'", domain, block_level)
                         continue
+                    elif not utils.is_domain_wanted(blocked):
+                        logger.warning("blocked='%s' is not wanted - SKIPPED!", blocked)
+                        continue
 
                     logger.debug("Invoking utils.deobfuscate_domain(%s, %s) ...", blocked, domain)
                     blocked = utils.deobfuscate_domain(blocked, domain)
-
                     logger.debug("blocked='%s' - DEOBFUSCATED!", blocked)
-                    if not utils.is_domain_wanted(blocked):
-                        logger.warning("blocked='%s' is not wanted - SKIPPED!", blocked)
-                        continue
 
                     logger.debug("Appending blocker='%s',blocked='%s',reason='%s',block_level='%s' ...",domain, blocked, reason, block_level)
                     blockdict.append({