From: Roland Häder Date: Tue, 3 Oct 2023 13:24:57 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7d196271c22710c640c4f2c449893a43a030b55e;p=fba.git Continued: - change has_obfuscation when detected, not when a domain wasn't deobfuscated - also count de-/obfuscated domains --- diff --git a/fba/commands.py b/fba/commands.py index f7165d6..ea96bf8 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -350,6 +350,7 @@ def fetch_blocks(args: argparse.Namespace) -> int: instances.set_total_blocks(blocker, blocking) blockdict = list() + deobfuscated = obfuscated = 0 logger.info("Checking %d entries from blocker='%s',software='%s' ...", len(blocking), blocker, software) for block in blocking: @@ -378,6 +379,8 @@ def fetch_blocks(args: argparse.Namespace) -> int: continue elif block["blocked"].find("*") >= 0: logger.debug("blocker='%s' uses obfuscated domains", blocker) + instances.set_has_obfuscation(blocker, True) + obfuscated = obfuscated + 1 # Some friendica servers also obscure domains without hash row = instances.deobfuscate("*", block["blocked"], block["hash"] if "hash" in block else None) @@ -385,14 +388,16 @@ def fetch_blocks(args: argparse.Namespace) -> int: logger.debug("row[]='%s'", type(row)) if row is None: logger.warning("Cannot deobfuscate blocked='%s',blocker='%s',software='%s' - SKIPPED!", block["blocked"], blocker, software) - instances.set_has_obfuscation(blocker, True) continue + deobfuscated = deobfuscated + 1 block["blocked"] = row["domain"] origin = row["origin"] nodeinfo_url = row["nodeinfo_url"] elif block["blocked"].find("?") >= 0: logger.debug("blocker='%s' uses obfuscated domains", blocker) + instances.set_has_obfuscation(blocker, True) + obfuscated = obfuscated + 1 # Some obscure them with question marks, not sure if that's dependent on version or not row = instances.deobfuscate("?", block["blocked"], block["hash"] if "hash" in block else None) @@ -400,9 +405,9 @@ def fetch_blocks(args: argparse.Namespace) -> int: logger.debug("row[]='%s'", type(row)) if row is None: logger.warning("Cannot deobfuscate blocked='%s',blocker='%s',software='%s' - SKIPPED!", block["blocked"], blocker, software) - instances.set_has_obfuscation(blocker, True) continue + deobfuscated = deobfuscated + 1 block["blocked"] = row["domain"] origin = row["origin"] nodeinfo_url = row["nodeinfo_url"] @@ -438,6 +443,8 @@ def fetch_blocks(args: argparse.Namespace) -> int: logger.debug("Invoking cookies.clear(%s) ...", block["blocked"]) cookies.clear(block["blocked"]) + logger.info("blocker='%s' has %d obfuscated domain(s) and %d of them could be deobfuscated.", block["blocker"], obfuscated, deobfuscated) + logger.debug("Checking if blocker='%s' has pending updates ...", blocker) if instances.has_pending(blocker): logger.debug("Flushing updates for blocker='%s' ...", blocker)