Fix regex IP match in hostname resolution
This commit is contained in:
@@ -565,7 +565,7 @@ def get_ip(host):
|
|||||||
ip_address = ''
|
ip_address = ''
|
||||||
if is_valid_ip(host):
|
if is_valid_ip(host):
|
||||||
return host
|
return host
|
||||||
elif not re.fullmatch(r'[0-9]+(?:\.[0-9]+){3}(?!\d*-[a-z0-9]{6})', host):
|
elif not re.match(r'^[0-9]+(?:\.[0-9]+){3}(?!\d*-[a-z0-9]{6})$', host):
|
||||||
try:
|
try:
|
||||||
ip_address = socket.getaddrinfo(host, None)[0][4][0]
|
ip_address = socket.getaddrinfo(host, None)[0][4][0]
|
||||||
logger.debug(u"IP Checker :: Resolved %s to %s." % (host, ip_address))
|
logger.debug(u"IP Checker :: Resolved %s to %s." % (host, ip_address))
|
||||||
|
Reference in New Issue
Block a user