def check_instance(args: argparse.Namespace) -> int:
logger.debug("args.domain='%s' - CALLED!", args.domain)
status = 0
- if not validators.domain(args.domain):
+ if not validators.hostname(args.domain):
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.hostname(args.domain):
logger.warning("args.domain='%s' is not valid.", args.domain)
return 100
elif blacklist.is_blacklisted(args.domain):
logger.debug("args[]='%s' - CALLED!", type(args))
logger.debug("args.domain='%s' - checking ...", args.domain)
- if not validators.domain(args.domain):
+ if not validators.hostname(args.domain):
logger.warning("args.domain='%s' is not valid.", args.domain)
return 100
elif blacklist.is_blacklisted(args.domain):
domain = utils.deobfuscate(domain, block["blocker"])
logger.debug("domain='%s' - AFTER!", domain)
- if not validators.domain(domain):
+ if not validators.hostname(domain):
logger.debug("domain='%s' is not a valid domain - SKIPPED!")
continue
elif blacklist.is_blacklisted(domain):
if not isinstance(text, str):
logger.debug("text[]='%s' is not of type 'str' - SKIPPED!", type(text))
continue
- elif validators.domain(text.strip()):
+ elif validators.hostname(text.strip()):
logger.debug("text='%s' is a domain - SKIPPED!", text.strip())
continue
if isinstance(args.domain, str) and args.domain != "" and domain_helper.is_wanted(args.domain):
database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE has_obfuscation = 1 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.hostname(args.software) == args.software:
database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE has_obfuscation = 1 AND software = ?", [args.software])
else:
database.cursor.execute("SELECT domain, software, nodeinfo_url FROM instances WHERE has_obfuscation = 1")
raise ValueError("Parameter 'domain' is empty")
elif domain.lower() != domain:
raise ValueError(f"Parameter domain='{domain}' must be all lower-case")
- elif not validators.domain(domain.split("/")[0]):
+ elif not validators.hostname(domain.split("/")[0]):
raise ValueError(f"domain='{domain}' is not a valid domain")
elif domain.endswith(".arpa"):
raise ValueError(f"domain='{domain}' is a domain for reversed IP addresses, please don't crawl them!")
raise ValueError("Parameter 'domain' is empty")
elif domain.lower() != domain:
wanted = False
- elif not validators.domain(domain.split("/")[0]):
+ elif not validators.hostname(domain.split("/")[0]):
logger.debug("domain='%s' is not a valid domain name - setting False ...", domain)
wanted = False
elif domain.endswith(".arpa"):