Fix regex IP match in hostname resolution

This commit is contained in:
JonnyWong16 2019-12-10 10:07:34 -08:00
parent 6e0a0d51b5
commit b7bb159630

View file

@ -565,7 +565,7 @@ def get_ip(host):
ip_address = ''
if is_valid_ip(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:
ip_address = socket.getaddrinfo(host, None)[0][4][0]
logger.debug(u"IP Checker :: Resolved %s to %s." % (host, ip_address))