From: Roland Häder Date: Sun, 11 Jun 2023 17:52:36 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d154a64084ce03b7f8d5fb62b1ee9e2fd9d3a75e;p=fba.git Continued: - logic fixed - debug messages added --- diff --git a/fba/networks/pleroma.py b/fba/networks/pleroma.py index ade0592..8c16f88 100644 --- a/fba/networks/pleroma.py +++ b/fba/networks/pleroma.py @@ -99,7 +99,8 @@ def fetch_blocks(domain: str, origin: str, nodeinfo_url: str): # DEBUG: print(f"DEBUG: blocked='{blocked}' is blacklisted - skipping!") continue elif blocked.count("*") > 1: - # -ACK!-oma also started obscuring domains without hash + # Obsured domain name with no hash + # DEBUG: print(f"DEBUG: Trying to de-obscure blocked='{blocked}' ...") fba.cursor.execute( "SELECT domain, nodeinfo_url FROM instances WHERE domain LIKE ? ORDER BY rowid LIMIT 1", [blocked.replace("*", "_")] ) @@ -110,18 +111,18 @@ def fetch_blocks(domain: str, origin: str, nodeinfo_url: str): print(f"WARNING: Cannot deobsfucate blocked='{blocked}' - SKIPPED!") continue + # DEBUG: print(f"DEBUG: blocked='{blocked}' de-obscured to '{searchres[0]}'") blocked = searchres[0] nodeinfo_url = searchres[1] - # DEBUG: print("DEBUG: Looked up domain:", blocked) - elif not validators.domain(blocked): + + # DEBUG: print(f"DEBUG: blocked='{blocked}'") + if not validators.domain(blocked): print(f"WARNING: blocked='{blocked}',software='pleroma' is not a valid domain name - skipped!") continue elif blocked.split(".")[-1] == "arpa": print(f"WARNING: blocked='{blocked}' is a reversed .arpa domain and should not be used generally.") continue - - # DEBUG: print("DEBUG: Looking up instance by domain:", blocked) - if not instances.is_registered(blocked): + elif not instances.is_registered(blocked): # Commit changes fba.connection.commit() @@ -181,14 +182,12 @@ def fetch_blocks(domain: str, origin: str, nodeinfo_url: str): if blocked == "": print("WARNING: blocked is empty after tidyup.domain():", domain, block_level) continue - elif not validators.domain(blocked): - print(f"WARNING: blocked='{blocked}',software='pleroma' is not a valid domain name - skipped!") - continue elif blacklist.is_blacklisted(blocked): # DEBUG: print(f"DEBUG: blocked='{blocked}' is blacklisted - skipping!") continue elif blocked.count("*") > 1: - # same domain guess as above, but for reasons field + # Obsured domain with no hash + # DEBUG: print(f"DEBUG: Trying to de-obscure blocked='{blocked}' ...") fba.cursor.execute( "SELECT domain, origin, nodeinfo_url FROM instances WHERE domain LIKE ? ORDER BY rowid LIMIT 1", [blocked.replace("*", "_")] ) @@ -199,11 +198,15 @@ def fetch_blocks(domain: str, origin: str, nodeinfo_url: str): print(f"WARNING: Cannot deobsfucate blocked='{blocked}' - SKIPPED!") continue + # DEBUG: print(f"DEBUG: blocked='{blocked}' de-obscured to '{searchres[0]}'") blocked = searchres[0] origin = searchres[1] nodeinfo_url = searchres[2] + elif not validators.domain(blocked): + print(f"WARNING: blocked='{blocked}',software='pleroma' is not a valid domain name - skipped!") + continue - # DEBUG: print("DEBUG: Looking up instance by domain:", blocked) + # DEBUG: print(f"DEBUG: blocked='{blocked}'") if blocked.split(".")[-1] == "arpa": print(f"WARNING: blocked='{blocked}' is a reversed .arpa domain and should not be used generally.") continue