diff --git a/monkey/infection_monkey/exploit/caching_agent_binary_repository.py b/monkey/infection_monkey/exploit/caching_agent_binary_repository.py index e7f00c54b..1a52806f0 100644 --- a/monkey/infection_monkey/exploit/caching_agent_binary_repository.py +++ b/monkey/infection_monkey/exploit/caching_agent_binary_repository.py @@ -1,4 +1,5 @@ import io +import logging import threading from functools import lru_cache @@ -7,6 +8,8 @@ from infection_monkey.island_api_client import IIslandAPIClient from . import IAgentBinaryRepository +logger = logging.getLogger(__name__) + class CachingAgentBinaryRepository(IAgentBinaryRepository): """ @@ -32,4 +35,7 @@ class CachingAgentBinaryRepository(IAgentBinaryRepository): @lru_cache(maxsize=None) def _download_binary_from_island(self, operating_system: OperatingSystem) -> bytes: os_name = operating_system.value - return self._island_api_client.get_agent_binary(os_name) + try: + return self._island_api_client.get_agent_binary(os_name) + except Exception as exc: + logger.warning(f"Error connecting to control server: {exc}")