From 35ef51725e48e2fbad878ca37fcaa29dd26921c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 30 Aug 2023 03:31:34 +0200 Subject: [PATCH] Continued: - need to check blacklist/is_wanted()-check first before invoking blocks.is_instance_blocked() --- fba/commands.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/fba/commands.py b/fba/commands.py index 3fb4ea6..df5bcb7 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -619,7 +619,13 @@ def fetch_todon_wiki(args: argparse.Namespace) -> int: logger.warning("Exception '%s' during fetching instances (fetch_cs) from blocked='%s'", type(exception), blocked) instances.set_last_error(blocked, exception) - if blocks.is_instance_blocked(blocker, blocked, block_level): + if not domain_helper.is_wanted(blocked): + logger.warning("blocked='%s' is not wanted - SKIPPED!", blocked) + continue + elif not domain_helper.is_wanted(blocker): + logger.warning("blocker='%s' is not wanted - SKIPPED!", blocker) + continue + elif blocks.is_instance_blocked(blocker, blocked, block_level): logger.debug("blocked='%s',block_level='%s' is already blocked - SKIPPED!", blocked, block_level) continue @@ -1595,12 +1601,15 @@ def recheck_obfuscation(args: argparse.Namespace) -> int: logger.debug("blocked='%s' was deobfuscated to blocked='%s'", block["blocked"], blocked) obfuscated = obfuscated - 1 - if blocks.is_instance_blocked(row["domain"], blocked): - logger.debug("blocked='%s' is already blocked by domain='%s' - SKIPPED!", blocked, row["domain"]) - continue - elif blacklist.is_blacklisted(blocked): + if blacklist.is_blacklisted(blocked): logger.debug("blocked='%s' is blacklisted - SKIPPED!", blocked) continue + elif blacklist.is_blacklisted(row["domain"]): + logger.debug("row[domain]='%s' is blacklisted - SKIPPED!", row["domain"]) + continue + elif blocks.is_instance_blocked(row["domain"], blocked): + logger.debug("blocked='%s' is already blocked by domain='%s' - SKIPPED!", blocked, row["domain"]) + continue block["block_level"] = blocks.alias_block_level(block["block_level"]) -- 2.39.5