From: Roland Häder Date: Fri, 12 Jan 2024 03:56:07 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=600b452ced0fbf1c9c9796cf5afed63a1baead5a;p=fba.git Continued: - need to negate this state: only skip/reject .i2p domains when they are not allowed by configuration (which is default) --- 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"):