From e876682d84490f421309dc26c582ab11aa50c121 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Fri, 7 Oct 2022 09:51:44 -0400 Subject: [PATCH] Island: Use NodeUpdateFacade in ScanEventHandler --- .../cc/agent_event_handlers/scan_event_handler.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/monkey/monkey_island/cc/agent_event_handlers/scan_event_handler.py b/monkey/monkey_island/cc/agent_event_handlers/scan_event_handler.py index b7c222830..7b35f3c6d 100644 --- a/monkey/monkey_island/cc/agent_event_handlers/scan_event_handler.py +++ b/monkey/monkey_island/cc/agent_event_handlers/scan_event_handler.py @@ -15,7 +15,7 @@ from monkey_island.cc.repository import ( UnknownRecordError, ) -from .utils import get_or_create_target_machine +from .node_update_facade import NodeUpdateFacade ScanEvent: TypeAlias = Union[PingScanEvent, TCPScanEvent] @@ -33,6 +33,7 @@ class ScanEventHandler: machine_repository: IMachineRepository, node_repository: INodeRepository, ): + self._node_update_facade = NodeUpdateFacade(machine_repository) self._agent_repository = agent_repository self._machine_repository = machine_repository self._node_repository = node_repository @@ -66,7 +67,7 @@ class ScanEventHandler: logger.exception("Unable to process tcp scan data") def _get_target_machine(self, event: ScanEvent) -> Machine: - return get_or_create_target_machine(self._machine_repository, event.target) + return self._node_update_facade.get_or_create_target_machine(event.target) def _get_source_node(self, event: ScanEvent) -> Node: machine = self._get_source_machine(event)