if domain == "":
logger.debug("domain is empty - SKIPPED!")
continue
- elif not utils.is_domain_wanted(domain):
- logger.warning("domain='%s' is not wanted - SKIPPED!", domain)
+ elif domain.endswith(".onion"):
+ logger.debug("domain='%s' is a TOR .onion domain - SKIPPED", domain)
+ continue
+ elif domain.endswith(".arpa"):
+ logger.debug("domain='%s' is a reverse IP address - SKIPPED", domain)
+ continue
+ elif domain.endswith(".tld"):
+ logger.debug("domain='%s' is a fake domain - SKIPPED", domain)
+ continue
+ elif domain.find("*") >= 0 or domain.find("?") >= 0:
+ logger.debug("domain='%s' is obfuscated - Invoking utils.deobfuscate(%s, %s) ...", domain, domain, block["blocker"])
+ domain = utils.deobfuscate(domain, block["blocker"])
+ logger.debug("domain='%s' - AFTER!", domain)
+
+ if not validators.domain(domain):
+ logger.debug("domain='%s' is not a valid domain - SKIPPED!")
+ continue
+ elif blacklist.is_blacklisted(domain):
+ logger.warning("domain='%s' is blacklisted - SKIPPED!", domain)
continue
logger.debug("Marking domain='%s' as handled", domain)
elif block["blocked"].find("*") >= 0 or block["blocked"].find("?") >= 0:
logger.debug("block='%s' is obfuscated.", block["blocked"])
obfuscated = obfuscated + 1
- blocked = utils.deobfuscate_domain(block["blocked"], row["domain"], block["hash"] if "hash" in block else None)
+ blocked = utils.deobfuscate(block["blocked"], row["domain"], block["hash"] if "hash" in block else None)
elif not utils.is_domain_wanted(block["blocked"]):
logger.warning("blocked='%s' is not wanted - SKIPPED!", block["blocked"])
continue
logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
continue
- logger.debug("Invoking utils.deobfuscate_domain(%s, %s) ...", blocked, domain)
- blocked = utils.deobfuscate_domain(blocked, domain)
+ logger.debug("Invoking utils.deobfuscate(%s, %s) ...", blocked, domain)
+ blocked = utils.deobfuscate(blocked, domain)
logger.debug("blocked='%s' - DEOBFUSCATED!", blocked)
if not utils.is_domain_wanted(blocked):
logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
continue
- logger.debug("Invoking utils.deobfuscate_domain(%s, %s) ...", blocked, domain)
- blocked = utils.deobfuscate_domain(blocked, domain)
+ logger.debug("Invoking utils.deobfuscate(%s, %s) ...", blocked, domain)
+ blocked = utils.deobfuscate(blocked, domain)
logger.debug("blocked='%s' - DEOBFUSCATED!", blocked)
if not utils.is_domain_wanted(blocked):
logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
continue
- logger.debug("Invoking utils.deobfuscate_domain(%s, %s) ...", blocked, domain)
- blocked = utils.deobfuscate_domain(blocked, domain)
+ logger.debug("Invoking utils.deobfuscate(%s, %s) ...", blocked, domain)
+ blocked = utils.deobfuscate(blocked, domain)
logger.debug("blocked='%s' - DEOBFUSCATED!", blocked)
logger.debug("Checking %d blockdict records ...", len(blockdict))
logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
continue
- logger.debug("Invoking utils.deobfuscate_domain(%s, %s) ...", blocked, domain)
- blocked = utils.deobfuscate_domain(blocked, domain)
+ logger.debug("Invoking utils.deobfuscate(%s, %s) ...", blocked, domain)
+ blocked = utils.deobfuscate(blocked, domain)
logger.debug("blocked='%s' - DEOBFUSCATED!", blocked)
if not utils.is_domain_wanted(blocked):
logger.debug("rows[%s]()=%d'", type(rows), len(rows))
for block in rows:
- logger.debug("Invoking utils.deobfuscate_domain(%s, %s) ...", block["blocked"], domain)
- block["blocked"] = utils.deobfuscate_domain(block["blocked"], domain)
+ logger.debug("Invoking utils.deobfuscate(%s, %s) ...", block["blocked"], domain)
+ block["blocked"] = utils.deobfuscate(block["blocked"], domain)
logger.debug("block[blocked]='%s' - DEOBFUSCATED!", block["blocked"])
if not utils.is_domain_wanted(block["blocked"]):
raise ValueError("Parameter 'command' is empty")
logger.debug("domain='%s' - BEFORE!", domain)
- domain = deobfuscate_domain(domain, blocker)
+ domain = deobfuscate(domain, blocker)
logger.debug("domain='%s' - DEOBFUSCATED!", domain)
if instances.has_pending(blocker):
logger.debug("wanted='%s' - EXIT!", wanted)
return wanted
-def deobfuscate_domain(domain: str, blocker: str, domain_hash: str = None) -> str:
+def deobfuscate(domain: str, blocker: str, domain_hash: str = None) -> str:
logger.debug("domain='%s',blocker='%s',domain_hash='%s' - CALLED!", domain, blocker, domain_hash)
domain_helper.raise_on(blocker)