diff --git a/monkey/monkey_island/cc/services/__init__.py b/monkey/monkey_island/cc/services/__init__.py index 14c5664e9..d75734d59 100644 --- a/monkey/monkey_island/cc/services/__init__.py +++ b/monkey/monkey_island/cc/services/__init__.py @@ -1,4 +1,3 @@ from .authentication_service import AuthenticationService from .aws import AWSService -from .island_mode_service import IslandModeService diff --git a/monkey/monkey_island/cc/services/initialize.py b/monkey/monkey_island/cc/services/initialize.py index 9e6425215..830e010d7 100644 --- a/monkey/monkey_island/cc/services/initialize.py +++ b/monkey/monkey_island/cc/services/initialize.py @@ -47,7 +47,7 @@ from monkey_island.cc.repository import ( ) from monkey_island.cc.server_utils.consts import MONKEY_ISLAND_ABS_PATH from monkey_island.cc.server_utils.encryption import ILockableEncryptor, RepositoryEncryptor -from monkey_island.cc.services import AWSService, IslandModeService +from monkey_island.cc.services import AWSService from monkey_island.cc.services.attack.technique_reports.T1003 import T1003, T1003GetReportData from monkey_island.cc.services.run_local_monkey import LocalMonkeyRunService from monkey_island.cc.setup.mongo.mongo_setup import MONGO_URL @@ -175,7 +175,6 @@ def _log_agent_binary_hashes(agent_binary_repository: IAgentBinaryRepository): def _register_services(container: DIContainer): container.register_instance(AWSService, container.resolve(AWSService)) container.register_instance(LocalMonkeyRunService, container.resolve(LocalMonkeyRunService)) - container.register_instance(IslandModeService, container.resolve(IslandModeService)) container.register_instance(AuthenticationService, container.resolve(AuthenticationService)) diff --git a/monkey/monkey_island/cc/services/island_mode_service.py b/monkey/monkey_island/cc/services/island_mode_service.py deleted file mode 100644 index bc4869b9a..000000000 --- a/monkey/monkey_island/cc/services/island_mode_service.py +++ /dev/null @@ -1,46 +0,0 @@ -from common.agent_configuration import AgentConfiguration -from monkey_island.cc.models import IslandMode -from monkey_island.cc.repository import IAgentConfigurationRepository, ISimulationRepository - - -class IslandModeService: - def __init__( - self, - _agent_configuration_repository: IAgentConfigurationRepository, - simulation_repository: ISimulationRepository, - default_agent_configuration: AgentConfiguration, - default_ransomware_agent_configuration: AgentConfiguration, - ): - self._agent_configuration_repository = _agent_configuration_repository - self._simulation_repository = simulation_repository - self._default_agent_configuration = default_agent_configuration - self._default_ransomware_agent_configuration = default_ransomware_agent_configuration - - def get_mode(self): - """ - Get's the island's current mode - - :return The island's current mode - :raises RetrievalError: If the mode could not be retrieved - """ - return self._simulation_repository.get_mode() - - def set_mode(self, mode: IslandMode): - """ - Set the island's mode - - :param mode: The island's new mode - :raises StorageError: If the mode could not be saved - """ - self._simulation_repository.set_mode(mode) - self._set_configuration(mode) - - def _set_configuration(self, mode: IslandMode): - if mode == IslandMode.RANSOMWARE: - self._agent_configuration_repository.store_configuration( - self._default_ransomware_agent_configuration - ) - else: - self._agent_configuration_repository.store_configuration( - self._default_agent_configuration - )