From 9d3be7e1d3936fff758d94fa8e05e3bfa15112e2 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Thu, 22 Sep 2022 17:37:14 +0200 Subject: [PATCH] Island: Implement AgentSignalsService.on_terminate_agents_signal --- .../monkey_island/cc/services/agent_signals_service.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/monkey/monkey_island/cc/services/agent_signals_service.py b/monkey/monkey_island/cc/services/agent_signals_service.py index 23a15dba9..473a10066 100644 --- a/monkey/monkey_island/cc/services/agent_signals_service.py +++ b/monkey/monkey_island/cc/services/agent_signals_service.py @@ -1,10 +1,13 @@ +import logging from datetime import datetime from typing import Optional from common.types import AgentID -from monkey_island.cc.models import AgentSignals +from monkey_island.cc.models import AgentSignals, Simulation from monkey_island.cc.repository import IAgentRepository, ISimulationRepository +logger = logging.getLogger(__name__) + class AgentSignalsService: def __init__( @@ -45,4 +48,7 @@ class AgentSignalsService: :param timestamp: Timestamp of the terminate signal """ - pass + simulation = self._simulation_repository.get_simulation() + updated_simulation = Simulation(mode=simulation.mode, terminate_signal_time=timestamp) + + self._simulation_repository.save_simulation(updated_simulation)