From 17d3795581a139cfb078f01e7bd9c430602c6027 Mon Sep 17 00:00:00 2001 From: Itay Mizeretz Date: Tue, 24 Oct 2017 15:42:52 +0300 Subject: [PATCH] Fix get_interface_to_target to always return an IP --- chaos_monkey/exploit/tools.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chaos_monkey/exploit/tools.py b/chaos_monkey/exploit/tools.py index 1fc76147a..60e3950a6 100644 --- a/chaos_monkey/exploit/tools.py +++ b/chaos_monkey/exploit/tools.py @@ -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