From 8aad5b16d5bb45dd8b624bc3e2e6abd67ce56fdc Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Thu, 24 Mar 2022 12:27:22 -0400 Subject: [PATCH] Agent: Fix tunnel address parsing in _close_tunnel() The current proxy schema specifies that tunnels start with "http://", not "https://". This lead to a bug in the tunnel address parsing which prevented the tunnel from being quit properly. --- monkey/infection_monkey/monkey.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/monkey/infection_monkey/monkey.py b/monkey/infection_monkey/monkey.py index 1fb2d4165..66d881d93 100644 --- a/monkey/infection_monkey/monkey.py +++ b/monkey/infection_monkey/monkey.py @@ -297,9 +297,7 @@ class InfectionMonkey: @staticmethod def _close_tunnel(): - tunnel_address = ( - ControlClient.proxies.get("https", "").replace("https://", "").split(":")[0] - ) + tunnel_address = ControlClient.proxies.get("https", "").replace("http://", "").split(":")[0] if tunnel_address: logger.info("Quitting tunnel %s", tunnel_address) tunnel.quit_tunnel(tunnel_address)