if isinstance(args.domain, str) and args.domain != "" and domain_helper.is_wanted(args.domain):
logger.debug("Fetching record for args.domain='%s' ...", args.domain)
- database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE (has_obfuscation = 1 OR has_obfuscation IS NULL) AND domain = ? ORDER BY last_blocked ASC", [args.domain])
+ database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE domain = ? LIMIT 1", [args.domain])
elif isinstance(args.software, str) and args.software != "" and validators.domain(args.software, rfc_2782=True) == args.software:
logger.debug("Fetching records for args.software='%s' ...", args.software)
database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE (has_obfuscation = 1 OR has_obfuscation IS NULL) AND software = ? ORDER BY last_blocked ASC", [args.software])
logger.debug("Invoking federation.fetch_blocks(%s) ...", row["domain"])
blocking = federation.fetch_blocks(row["domain"])
+ logger.debug("Setting has_obfuscation=False for row[domain]='%s' ...", row["domain"])
+ instances.set_has_obfuscation(row["domain"], False)
+
logger.debug("blocking()=%d", len(blocking))
if len(blocking) == 0:
logger.debug("Empty blocking list, trying individual fetch_blocks() for row[software]='%s' ...", row["software"])
obfuscated = 0
blockdict = list()
- logger.info("Checking %d block(s) from domain='%s' ...", len(blocking), row["domain"])
+ logger.info("Checking %d block(s) from row[domain]='%s' ...", len(blocking), row["domain"])
for block in blocking:
logger.debug("block[blocked]='%s'", block["blocked"])
blocked = None
logger.debug("block[blocked] is empty - SKIPPED!")
continue
elif block["blocked"].endswith(".onion"):
- logger.debug("blocked='%s' is a TOR onion domain name - SKIPPED!", block["blocked"])
+ logger.debug("block[blocked]='%s' is a TOR onion domain name - SKIPPED!", block["blocked"])
continue
elif block["blocked"].endswith(".i2p") and not config.get("allow_i2p_domain"):
- logger.debug("blocked='%s' is an I2P onion domain name - SKIPPED!", block["blocked"])
+ logger.debug("block[blocked]='%s' is an I2P onion domain name - SKIPPED!", block["blocked"])
continue
elif block["blocked"].endswith(".arpa"):
- logger.debug("blocked='%s' is a reversed IP address - SKIPPED!", block["blocked"])
+ logger.debug("block[blocked]='%s' is a reversed IP address - SKIPPED!", block["blocked"])
continue
elif block["blocked"].endswith(".tld"):
- logger.debug("blocked='%s' is a fake domain name - SKIPPED!", block["blocked"])
+ logger.debug("block[blocked]='%s' is a fake domain name - SKIPPED!", block["blocked"])
continue
elif block["blocked"].find("*") >= 0 or block["blocked"].find("?") >= 0:
- logger.debug("block='%s' is obfuscated.", block["blocked"])
+ logger.debug("block[blocked]='%s' is obfuscated.", block["blocked"])
obfuscated = obfuscated + 1
blocked = utils.deobfuscate(block["blocked"], row["domain"], block["digest"] if "digest" in block else None)
elif not domain_helper.is_wanted(block["blocked"]):
- logger.debug("blocked='%s' is not wanted - SKIPPED!", block["blocked"])
+ logger.debug("block[blocked]='%s' is not wanted - SKIPPED!", block["blocked"])
continue
elif blocks.is_instance_blocked(row["domain"], block["blocked"]):
- logger.debug("blocked='%s' is already blocked - SKIPPED!", block["blocked"])
+ logger.debug("block[blocked]='%s' is already blocked - SKIPPED!", block["blocked"])
continue
logger.debug("blocked[%s]='%s',block[blocked]='%s'", type(blocked), blocked, block["blocked"])
})
logger.debug("Setting obfuscated=%d for row[domain]='%s' ...", obfuscated, row["domain"])
- instances.set_has_obfuscation(row["domain"], (obfuscated > 0))
instances.set_obfuscated_blocks(row["domain"], obfuscated)
logger.info("domain='%s' has %d obfuscated domain(s)", row["domain"], obfuscated)