diff --git a/monkey/infection_monkey/exploit/caching_agent_binary_repository.py b/monkey/infection_monkey/exploit/caching_agent_binary_repository.py index 1a52806f0..46e752470 100644 --- a/monkey/infection_monkey/exploit/caching_agent_binary_repository.py +++ b/monkey/infection_monkey/exploit/caching_agent_binary_repository.py @@ -2,6 +2,7 @@ import io import logging import threading from functools import lru_cache +from typing import Optional from common import OperatingSystem from infection_monkey.island_api_client import IIslandAPIClient @@ -33,9 +34,10 @@ class CachingAgentBinaryRepository(IAgentBinaryRepository): return io.BytesIO(self._download_binary_from_island(operating_system)) @lru_cache(maxsize=None) - def _download_binary_from_island(self, operating_system: OperatingSystem) -> bytes: + def _download_binary_from_island(self, operating_system: OperatingSystem) -> Optional[bytes]: os_name = operating_system.value try: return self._island_api_client.get_agent_binary(os_name) except Exception as exc: logger.warning(f"Error connecting to control server: {exc}") + return None