logger.debug("args.domain='%s' - CALLED!", args.domain)
status = 0
- if not validators.domain(args.domain):
+ if not validators.domain(args.domain, rfc_2782=True):
logger.warning("args.domain='%s' is not valid", args.domain)
status = 100
elif blacklist.is_blacklisted(args.domain):
logger.debug("args[]='%s' - CALLED!", type(args))
if args.domain is not None and args.domain != "":
logger.debug("args.domain='%s' - checking ...", args.domain)
- if not validators.domain(args.domain):
+ if not validators.domain(args.domain, rfc_2782=True):
logger.warning("args.domain='%s' is not valid.", args.domain)
return 100
elif blacklist.is_blacklisted(args.domain):
# Is domain or software set?
if args.domain not in [None, ""]:
logger.debug("args.domain='%s' - checking ...", args.domain)
- if not validators.domain(args.domain):
+ if not validators.domain(args.domain, rfc_2782=True):
logger.warning("args.domain='%s' is not valid.", args.domain)
return 100
elif blacklist.is_blacklisted(args.domain):
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 = ?", [args.domain])
- elif isinstance(args.software, str) and args.software != "" and validators.domain(args.software) == args.software:
+ 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 = ?", [args.software])
else:
logger.info("Checking %d domains ...", len(rows))
for row in rows:
logger.debug("row[domain]='%s'", row["domain"])
- if not validators.domain(row["domain"].split("/")[0]):
+ if not validators.domain(row["domain"].split("/")[0], rfc_2782=True):
logger.info("Invalid row[domain]='%s' found, removing ...", row["domain"])
database.cursor.execute("DELETE FROM blocks WHERE blocker = ? OR blocked = ?", [row["domain"], row["domain"]])
database.cursor.execute("DELETE FROM instances WHERE domain = ? LIMIT 1", [row["domain"]])
raise ValueError(f"Parameter domain='{domain}' must be all lower-case")
elif "?" in domain:
raise ValueError(f"Parameter domain='{domain}' contains a question-mark")
- elif not validators.domain(domain.split("/")[0]):
+ elif not validators.domain(domain.split("/")[0], rfc_2782=True):
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!")
if domain.lower() != domain:
logger.debug("domain='%s' is not all-lowercase - setting False ...", domain)
wanted = False
- elif not validators.domain(domain.split("/")[0]):
+ elif not validators.domain(domain.split("/")[0], rfc_2782=True):
logger.debug("domain='%s' is not a valid domain name - setting False ...", domain)
wanted = False
elif domain.endswith(".arpa"):
logger.debug("Marking domain='%s' as handled", domain)
domains.append(domain)
- if not validators.domain(domain):
+ if not validators.domain(domain, rfc_2782=True):
logger.debug("domain='%s' is not a valid domain - SKIPPED!")
continue
elif blacklist.is_blacklisted(domain):
logger.warning("instance='%s' contains double-dot, removing ...", instance)
instance = instance.replace("..", ".")
+ logger.debug("instance='%s'", instance)
+ if not validators.domain(instance, rfc_2782=True):
+ logger.warning("instance='%s' is not a valid domain - SKIPPED!", instance)
+ continue
+
logger.debug("instance='%s' - BEFORE!", instance)
instance = domain_helper.encode_idna(instance)
logger.debug("instance='%s' - AFTER!", instance)
"reason": reason,
})
continue
- elif not validators.domain(domain.split("/")[0]):
+ elif not validators.domain(domain.split("/")[0], rfc_2782=True):
logger.warning("domain='%s' is not a valid domain - SKIPPED!", domain)
continue
raise ValueError(f"software[]='{type(software)}' is not of type 'str'")
elif software == "":
raise ValueError("Parameter 'software' is empty")
- elif origin is not None and not validators.domain(origin.split("/")[0]):
+ elif origin is not None and not validators.domain(origin.split("/")[0], rfc_2782=True):
raise ValueError(f"Bad origin name='{origin}'")
elif blacklist.is_blacklisted(domain):
raise Exception(f"domain='{domain}' is blacklisted, but function invoked")
if blocked in [None, ""]:
logger.warning("blocked[%s]='%s' is empty after tidyup.domain(): domain='%s',block_level='%s' - SKIPPED!", type(blocked), blocked, domain, block_level)
continue
- elif validators.domain(blocked) and blacklist.is_blacklisted(blocked):
+ elif validators.domain(blocked, rfc_2782=True) and blacklist.is_blacklisted(blocked):
logger.debug("blocked='%s' is blacklisted - SKIPPED!")
continue
logger.debug("domain='%s',blocker='%s',domain_hash='%s' - CALLED!", domain, blocker, domain_hash)
domain_helper.raise_on(blocker)
- if validators.domain(domain) and blacklist.is_blacklisted(domain):
+ if validators.domain(domain, rfc_2782=True) and blacklist.is_blacklisted(domain):
raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
elif not isinstance(domain_hash, str) and domain_hash is not None:
raise ValueError(f"Parameter domain_hash[]='{type(domain_hash)}' is not of type 'str'")