From a3de04d9c08d9206b3ce1684be8e10541856b329 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 28 Feb 2022 12:32:16 -0500 Subject: [PATCH] Agent: Remove agent download optimization from get_target_monkey() This optimization was not functioning properly. This will be refactored and optimized in the near future, so it's not worth the effort to debug this at the present time. --- monkey/infection_monkey/exploit/tools/helpers.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/monkey/infection_monkey/exploit/tools/helpers.py b/monkey/infection_monkey/exploit/tools/helpers.py index 47057b63f..6d2538fc9 100644 --- a/monkey/infection_monkey/exploit/tools/helpers.py +++ b/monkey/infection_monkey/exploit/tools/helpers.py @@ -1,5 +1,4 @@ import logging -from pathlib import Path logger = logging.getLogger(__name__) @@ -12,25 +11,11 @@ def try_get_target_monkey(host): def get_target_monkey(host): - import platform - import sys - from infection_monkey.control import ControlClient if not host.os.get("type"): return None - if host.os.get("type") == platform.system().lower(): - try: - # When running from source, sys.executable will be "python", not an agent. - if "monkey" in Path(sys.executable).name: - return sys.executable - except Exception as ex: - logger.warning( - "Unable to retrieve this executable's path, downloading executable from the island " - f"instead: {ex}" - ) - return ControlClient.download_monkey_exe(host)