From c44b86ca119a6a9e341a6b4eca96838c59f48d6a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 15 Sep 2024 18:03:34 +0200 Subject: [PATCH] Continued: - skip invalid domains after checking them for obfuscation with asterisks or question marks --- fba/commands.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fba/commands.py b/fba/commands.py index 4abf8b7..539aee3 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -360,7 +360,7 @@ def fetch_blocks(args: argparse.Namespace) -> int: for block in blocking: logger.debug("blocked='%s',block_level='%s',reason='%s'", block["blocked"], block["block_level"], block["reason"]) - if block["block_level"] == "": + if block["block_level"] in [None, ""]: logger.warning("block_level is empty, blocker='%s',blocked='%s'", block["blocker"], block["blocked"]) continue @@ -428,6 +428,9 @@ def fetch_blocks(args: argparse.Namespace) -> int: block["blocked"] = row["domain"] origin = row["origin"] nodeinfo_url = row["nodeinfo_url"] + elif not validators.domain(block["blocked"], rfc_2782=True): + logger.warning("block[blocked]='%s' is not a valid domain - SKIPPED!", block["blocked"]) + continue logger.debug("Looking up instance by domain, block[blocked]='%s'", block["blocked"]) if block["blocked"] in [None, ""]: -- 2.39.5