forked from p15670423/monkey
Island: Rename IslandModeEnum.SET_ISLAND_MODE's subscribers' arguments from 'event' to 'mode'
This commit is contained in:
parent
c1e15f8be5
commit
add31fe397
|
@ -1,5 +1,3 @@
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from common.agent_configuration import AgentConfiguration
|
from common.agent_configuration import AgentConfiguration
|
||||||
from monkey_island.cc.models import IslandMode
|
from monkey_island.cc.models import IslandMode
|
||||||
from monkey_island.cc.repository import IAgentConfigurationRepository
|
from monkey_island.cc.repository import IAgentConfigurationRepository
|
||||||
|
@ -20,8 +18,7 @@ class set_agent_configuration_per_island_mode:
|
||||||
self._default_agent_configuration = default_agent_configuration
|
self._default_agent_configuration = default_agent_configuration
|
||||||
self._default_ransomware_agent_configuration = default_ransomware_agent_configuration
|
self._default_ransomware_agent_configuration = default_ransomware_agent_configuration
|
||||||
|
|
||||||
def __call__(self, event: Any = None):
|
def __call__(self, mode: IslandMode):
|
||||||
mode = event
|
|
||||||
if mode == IslandMode.RANSOMWARE:
|
if mode == IslandMode.RANSOMWARE:
|
||||||
self._agent_configuration_repository.store_configuration(
|
self._agent_configuration_repository.store_configuration(
|
||||||
self._default_ransomware_agent_configuration
|
self._default_ransomware_agent_configuration
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from typing import Any
|
from monkey_island.cc.models import IslandMode
|
||||||
|
|
||||||
from monkey_island.cc.repository import ISimulationRepository
|
from monkey_island.cc.repository import ISimulationRepository
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,6 +13,5 @@ class set_simulation_mode:
|
||||||
):
|
):
|
||||||
self._simulation_repository = simulation_repository
|
self._simulation_repository = simulation_repository
|
||||||
|
|
||||||
def __call__(self, event: Any = None):
|
def __call__(self, mode: IslandMode):
|
||||||
mode = event
|
|
||||||
self._simulation_repository.set_mode(mode)
|
self._simulation_repository.set_mode(mode)
|
||||||
|
|
|
@ -28,7 +28,7 @@ class IslandMode(AbstractResource):
|
||||||
def put(self):
|
def put(self):
|
||||||
try:
|
try:
|
||||||
mode = IslandModeEnum(request.json)
|
mode = IslandModeEnum(request.json)
|
||||||
self._island_event_queue.publish(topic=IslandEventTopic.SET_ISLAND_MODE, event=mode)
|
self._island_event_queue.publish(topic=IslandEventTopic.SET_ISLAND_MODE, mode=mode)
|
||||||
return {}, HTTPStatus.NO_CONTENT
|
return {}, HTTPStatus.NO_CONTENT
|
||||||
except (AttributeError, json.decoder.JSONDecodeError):
|
except (AttributeError, json.decoder.JSONDecodeError):
|
||||||
return {}, HTTPStatus.BAD_REQUEST
|
return {}, HTTPStatus.BAD_REQUEST
|
||||||
|
|
Loading…
Reference in New Issue