From 080e36fa6c5fb2ebe29f60c0334e422eef816208 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 11 Jul 2023 10:24:04 +0200 Subject: [PATCH] Continued: - exclude chaos.social here as their API for fetching blocks is disabled and invoking set_total_blocks() would reset it to zero --- fba/commands.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/fba/commands.py b/fba/commands.py index e6008de..4d4f01f 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -334,8 +334,10 @@ def fetch_blocks(args: argparse.Namespace) -> int: else: logger.warning("Unknown software: blocker='%s',software='%s'", blocker, software) - logger.debug("Invoking instances.set_total_blocks(%s, %d) ...", blocker, len(blocking)) - instances.set_total_blocks(blocker, blocking) + logger.debug("blocker='%s'", blocker) + if blocker != "chaos.social": + logger.debug("Invoking instances.set_total_blocks(%s, %d) ...", blocker, len(blocking)) + instances.set_total_blocks(blocker, blocking) logger.info("Checking %d entries from blocker='%s',software='%s' ...", len(blocking), blocker, software) blockdict = list() @@ -685,8 +687,8 @@ def fetch_cs(args: argparse.Namespace): instances.set_total_blocks(blocker, blocking) logger.debug("blocklist[silenced]()=%d,blocklist[reject]()=%d", len(blocklist["silenced"]), len(blocklist["reject"])) - blockdict = list() if len(blocking) > 0: + blockdict = list() for block_level in blocklist: logger.info("block_level='%s' has %d row(s)", block_level, len(blocklist[block_level])) @@ -1104,8 +1106,10 @@ def fetch_oliphant(args: argparse.Namespace) -> int: if reject_reports: utils.process_block(block["blocker"], domain, None, "reject_reports") - logger.debug("Invoking instances.set_total_blocks(%s, domains()=%d) ...", block["blocker"], len(domains)) - instances.set_total_blocks(block["blocker"], domains) + logger.debug("block[blocker]='%s'", block["blocker"]) + if block["blocker"] != "chaos.social": + logger.debug("Invoking instances.set_total_blocks(%s, domains()=%d) ...", block["blocker"], len(domains)) + instances.set_total_blocks(block["blocker"], domains) logger.debug("Checking if blocker='%s' has pending updates ...", block["blocker"]) if instances.has_pending(block["blocker"]): @@ -1444,8 +1448,10 @@ def recheck_obfuscation(args: argparse.Namespace) -> int: else: logger.warning("Unknown sofware: domain='%s',software='%s'", row["domain"], row["software"]) - logger.debug("Invoking instances.set_total_blocks(%s, %d) ...", row["domain"], len(blocking)) - instances.set_total_blocks(row["domain"], blocking) + logger.debug("row[domain]='%s'", row["domain"]) + if row["domain"] != "chaos.social": + logger.debug("Invoking instances.set_total_blocks(%s, %d) ...", row["domain"], len(blocking)) + instances.set_total_blocks(row["domain"], blocking) logger.info("Checking %d block(s) from domain='%s' ...", len(blocking), row["domain"]) obfuscated = 0 -- 2.39.5