Fix get_interface_to_target to always return an IP

This commit is contained in:
Itay Mizeretz 2017-10-24 15:42:52 +03:00
parent 8c14136213
commit 17d3795581
1 changed files with 3 additions and 1 deletions

View File

@ -389,7 +389,9 @@ class HTTPTools(object):
def get_interface_to_target(dst):
if sys.platform == "win32":
return get_close_matches(dst, local_ips())[0]
ips = local_ips()
matches = get_close_matches(dst, ips)
return matches[0] if (len(matches) > 0) else ips[0]
else:
# based on scapy implementation