From 5a708db5ccb9697b42f127863470fd0fc5663c13 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 15 Mar 2022 12:58:24 -0400 Subject: [PATCH] Agent: Remove disused methods from ControlClient --- monkey/infection_monkey/control.py | 44 ------------------------------ 1 file changed, 44 deletions(-) diff --git a/monkey/infection_monkey/control.py b/monkey/infection_monkey/control.py index 9d38b8adf..985c8e984 100644 --- a/monkey/infection_monkey/control.py +++ b/monkey/infection_monkey/control.py @@ -132,28 +132,6 @@ class ControlClient(object): else: ControlClient.proxies["https"] = f"{proxy_address}:{proxy_port}" - @staticmethod - def keepalive(): - if not WormConfiguration.current_server: - return - try: - monkey = {} - if ControlClient.proxies: - monkey["tunnel"] = ControlClient.proxies.get("https") - requests.patch( # noqa: DUO123 - "https://%s/api/monkey/%s" % (WormConfiguration.current_server, GUID), - data=json.dumps(monkey), - headers={"content-type": "application/json"}, - verify=False, - proxies=ControlClient.proxies, - timeout=MEDIUM_REQUEST_TIMEOUT, - ) - except Exception as exc: - logger.warning( - "Error connecting to control server %s: %s", WormConfiguration.current_server, exc - ) - return {} - @staticmethod def send_telemetry(telem_category, json_data: str): if not WormConfiguration.current_server: @@ -252,28 +230,6 @@ class ControlClient(object): ) return {} - @staticmethod - def check_for_stop(): - ControlClient.load_control_config() - return not WormConfiguration.alive - - @staticmethod - def spoof_host_os_info(is_windows, is_32bit): - if is_windows: - os = "windows" - if is_32bit: - arch = "x86" - else: - arch = "amd64" - else: - os = "linux" - if is_32bit: - arch = "i686" - else: - arch = "x86_64" - - return {"os": {"type": os, "machine": arch}} - @staticmethod def create_control_tunnel(): if not WormConfiguration.current_server: