is_blacklisted, reason, int = self.__is_blacklisted(vhost)
if is_blacklisted:
return (False, reason, int)
+
+ if vhost.replace(".", "").isdigit() and not self.__is_numeric_ip(vhost):
+ return (True, '@c9Acceptable@c', None)
is_resolvable, resolved, host = self.__is_resolvable(vhost)
(txt_record_exists, resolving_error) = self.check_nick_in_TXT_records(vhost, nick)
return (True, '@c9Acceptable@c', 'TXT record')
else:
return (True, '@c9Acceptable@c', None)
-
+
+ def __is_numeric_ip(self, host):
+ try:
+ parts = host.split(".")
+ return len(parts) == len([x for x in parts if 0 <= int(x) <= 255]) == 4
+ except:
+ return False
+
def __is_resolvable(self, host):
try:
res = getaddrinfo(host, 80)