From 600b452ced0fbf1c9c9796cf5afed63a1baead5a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 12 Jan 2024 04:56:07 +0100 Subject: [PATCH] Continued: - need to negate this state: only skip/reject .i2p domains when they are not allowed by configuration (which is default) --- fba/commands.py | 4 ++-- fba/helpers/domain.py | 4 ++-- fba/helpers/processing.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fba/commands.py b/fba/commands.py index 3f10f71..ce6623e 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -373,7 +373,7 @@ def fetch_blocks(args: argparse.Namespace) -> int: elif block["blocked"].endswith(".onion"): logger.debug("blocked='%s' is a TOR .onion domain - SKIPPED", block["blocked"]) continue - elif block["blocked"].endswith(".i2p") and config.get("allow_i2p_domain") == "true": + elif block["blocked"].endswith(".i2p") and not config.get("allow_i2p_domain") == "true": logger.debug("blocked='%s' is an I2P .onion domain - SKIPPED", block["blocked"]) continue elif block["blocked"].endswith(".arpa"): @@ -1342,7 +1342,7 @@ def recheck_obfuscation(args: argparse.Namespace) -> int: elif block["blocked"].endswith(".onion"): logger.debug("blocked='%s' is a TOR onion domain name - SKIPPED!", block["blocked"]) continue - elif block["blocked"].endswith(".i2p") and config.get("allow_i2p_domain") == "true": + elif block["blocked"].endswith(".i2p") and not config.get("allow_i2p_domain") == "true": logger.debug("blocked='%s' is an I2P onion domain name - SKIPPED!", block["blocked"]) continue elif block["blocked"].endswith(".arpa"): diff --git a/fba/helpers/domain.py b/fba/helpers/domain.py index 39fbb77..8614892 100644 --- a/fba/helpers/domain.py +++ b/fba/helpers/domain.py @@ -42,7 +42,7 @@ def raise_on(domain: str): raise ValueError(f"domain='{domain}' is not a valid domain") elif domain.endswith(".onion"): raise ValueError(f"domain='{domain}' is a TOR, please don't crawl them!") - elif domain.endswith(".i2p") and config.get("allow_i2p_domain") == "true": + elif domain.endswith(".i2p") and not config.get("allow_i2p_domain") == "true": raise ValueError(f"domain='{domain}' is an I2P, please don't crawl them!") elif domain.endswith(".arpa"): raise ValueError(f"domain='{domain}' is a domain for reversed IP addresses, please don't crawl them!") @@ -97,7 +97,7 @@ def is_wanted(domain: str) -> bool: elif domain.endswith(".onion"): logger.debug("domain='%s' is a TOR .onion domain - setting False ...", domain) wanted = False - elif domain.endswith(".i2p") and config.get("allow_i2p_domain") == "true": + elif domain.endswith(".i2p") and not config.get("allow_i2p_domain") == "true": logger.debug("domain='%s' is an I2P domain - setting False ...", domain) wanted = False elif domain.endswith(".tld"): diff --git a/fba/helpers/processing.py b/fba/helpers/processing.py index 5e0b832..5a96ac9 100644 --- a/fba/helpers/processing.py +++ b/fba/helpers/processing.py @@ -205,7 +205,7 @@ def csv_block(blocker: str, url: str, command: str): elif domain.endswith(".onion"): logger.debug("domain='%s' is a TOR .onion domain - SKIPPED", domain) continue - elif domain.endswith(".i2p") and config.get("allow_i2p_domain") == "true": + elif domain.endswith(".i2p") and not config.get("allow_i2p_domain") == "true": logger.debug("domain='%s' is an I2P .onion domain - SKIPPED", domain) continue elif domain.endswith(".arpa"): -- 2.39.5