Agent: Fix broken logic in get_target_monkey() download optimization

This commit is contained in:
Mike Salvatore 2022-02-28 07:46:16 -05:00
parent ec9d3822a6
commit a53ff7d0d9
1 changed files with 3 additions and 14 deletions

View File

@ -16,24 +16,13 @@ def get_target_monkey(host):
from infection_monkey.control import ControlClient
if host.monkey_exe:
return host.monkey_exe
if not host.os.get("type"):
return None
monkey_path = ControlClient.download_monkey_exe(host)
if host.os.get("type") == platform.system().lower():
return sys.executable
if host.os.get("machine") and monkey_path:
host.monkey_exe = monkey_path
if not monkey_path:
if host.os.get("type") == platform.system().lower():
# if exe not found, and we have the same arch, use our exe
if host.os.get("machine", "").lower() == platform.machine().lower():
monkey_path = sys.executable
return monkey_path
return ControlClient.download_monkey_exe(host)
def get_target_monkey_by_os(is_windows, is_32bit):