"last_error_details" : {},
# Wether obfuscation has been used
"has_obfuscation" : {},
- # Determined software
+ # Original software
+ "original_software" : {},
+ # Aliased software
"software" : {},
}
logger.info("Adding instance domain='%s',origin='%s',software='%s',command='%s' ...", domain, origin, software, command)
database.cursor.execute(
- "INSERT INTO instances (domain, origin, command, hash, software, first_seen) VALUES (?, ?, ?, ?, ?, ?)",
+ "INSERT INTO instances (domain, origin, command, hash, software, original_software, first_seen) VALUES (?, ?, ?, ?, ?, ?, ?)",
(
domain,
origin,
command,
utils.get_hash(domain),
software,
+ software,
time.time()
),
)
logger.debug("Setting last_error_details='%s' (error_message)", error['error_message'])
_set_data("last_status_code" , domain, error["status_code"])
_set_data("last_error_details", domain, error["error_message"] if error["error_message"] != "" else None)
+ elif "json" in error and "error" in error["json"] and "msg" in error["json"]:
+ logger.debug("Setting last_error_details='%s' (json,error)", error["json"]["msg"])
+ _set_data("last_status_code" , domain, error["status_code"])
+ _set_data("last_error_details", domain, error["json"]["msg"] if error["json"]["msg"] != "" else None)
elif "json" in error and "error" in error["json"] and "message" in error["json"]["error"]:
logger.debug("Setting last_error_details='%s' (json,error)", error["json"]["error"]["message"])
_set_data("last_status_code" , domain, error["status_code"])
logger.debug("domain='%s',skip_raise='%s' - CALLED!", domain, skip_raise)
domain_helper.raise_on(domain)
- if not isinstance(skip_raise, bool):
+ if blacklist.is_blacklisted(domain):
+ raise Exception(f"domain='{domain}' is blacklisted but function has been invoked")
+ elif not isinstance(skip_raise, bool):
raise ValueError(f"skip_raise[]='{type(skip_raise)}' is not type of 'bool'")
if not skip_raise:
raise ValueError(f"Parameter url[]='{type(url)}' is not of type 'str'")
elif url == "":
raise ValueError("Parameter 'url' is empty")
+ elif url is not None and not validators.url(url):
+ raise ValueError(f"Parameter url='{url}' is not a valid URL")
# Set timestamp
_set_data("nodeinfo_url", domain, url)
_set_data("has_obfuscation", domain, status)
logger.debug("EXIT!")
+def set_original_software(domain: str, software: str):
+ logger.debug("domain='%s',software='%s' - CALLED!", domain, software)
+ domain_helper.raise_on(domain)
+
+ if not isinstance(software, str) and software is not None:
+ raise ValueError(f"Parameter software[]='{type(software)}' is not of type 'str'")
+ elif software == "":
+ raise ValueError("Parameter 'software' is empty")
+
+ # Set original software
+ _set_data("original_software", domain, software)
+ logger.debug("EXIT!")
+
+
def set_software(domain: str, software: str):
logger.debug("domain='%s',software='%s' - CALLED!", domain, software)
domain_helper.raise_on(domain)
elif software == "":
raise ValueError("Parameter 'software' is empty")
- # Set timestamp
+ # Set software (maybe aliased to generic name)
_set_data("software", domain, software)
logger.debug("EXIT!")