Island: Implement AgentSignalsService.on_terminate_agents_signal

This commit is contained in:
Ilija Lazoroski 2022-09-22 17:37:14 +02:00 committed by Mike Salvatore
parent 5eeee2a60d
commit 9d3be7e1d3
1 changed files with 8 additions and 2 deletions

View File

@ -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)