From c124db7880ff645ff24b3b238fbebce9c1bb3985 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 5 Oct 2021 13:51:03 -0400 Subject: [PATCH] Agent: Use different proxy scheme on Windows --- monkey/infection_monkey/control.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/monkey/infection_monkey/control.py b/monkey/infection_monkey/control.py index 7b8f46f81..62bd5872a 100644 --- a/monkey/infection_monkey/control.py +++ b/monkey/infection_monkey/control.py @@ -115,7 +115,20 @@ class ControlClient(object): if proxy_find: proxy_address, proxy_port = proxy_find logger.info("Found tunnel at %s:%s" % (proxy_address, proxy_port)) - ControlClient.proxies["https"] = PROXY_SCHEMA % (proxy_address, proxy_port) + from infection_monkey.utils.environment import is_windows_os + + logger.info(f"requests version: {requests.__version__}") + import urllib3 + + logger.info(f"urllib3 version: {urllib3.__version__}") + if is_windows_os(): + ControlClient.proxies["https"] = "https://%s:%s" % ( + proxy_address, + proxy_port, + ) + else: + ControlClient.proxies["https"] = PROXY_SCHEMA % (proxy_address, proxy_port) + logger.info(ControlClient.proxies) return ControlClient.find_server() else: logger.info("No tunnel found")