diff --git a/monkey/infection_monkey/exploit/caching_agent_binary_repository.py b/monkey/infection_monkey/exploit/caching_agent_binary_repository.py index 8af4b7a4d..1d8067da3 100644 --- a/monkey/infection_monkey/exploit/caching_agent_binary_repository.py +++ b/monkey/infection_monkey/exploit/caching_agent_binary_repository.py @@ -34,8 +34,7 @@ class CachingAgentBinaryRepository(IAgentBinaryRepository): @lru_cache(maxsize=None) def _download_binary_from_island(self, operating_system: OperatingSystem) -> bytes: - os_name = operating_system.value try: - return self._island_api_client.get_agent_binary(os_name) + return self._island_api_client.get_agent_binary(operating_system) except IslandAPIError as err: raise RetrievalError(err) diff --git a/monkey/infection_monkey/island_api_client/http_island_api_client.py b/monkey/infection_monkey/island_api_client/http_island_api_client.py index 7c8cab1ab..3b2adfe61 100644 --- a/monkey/infection_monkey/island_api_client/http_island_api_client.py +++ b/monkey/infection_monkey/island_api_client/http_island_api_client.py @@ -3,6 +3,7 @@ import logging import requests +from common import OperatingSystem from common.common_consts.timeouts import LONG_REQUEST_TIMEOUT, MEDIUM_REQUEST_TIMEOUT from . import ( @@ -78,7 +79,8 @@ class HTTPIslandAPIClient(IIslandAPIClient): return response.content @handle_island_errors - def get_agent_binary(self, os_name: str): + def get_agent_binary(self, operating_system: OperatingSystem): + os_name = operating_system.value response = requests.get( # noqa: DUO123 f"{self._api_url}/agent-binaries/{os_name}", verify=False,