From c632b9b77bb578bd7203ed71e87cfe3976278dc0 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Thu, 29 Sep 2022 15:09:29 -0400 Subject: [PATCH] Island: Rename dest -> target --- .../handle_ping_scan_event.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/monkey/monkey_island/cc/agent_event_handlers/handle_ping_scan_event.py b/monkey/monkey_island/cc/agent_event_handlers/handle_ping_scan_event.py index f73f461e3..18e66c52a 100644 --- a/monkey/monkey_island/cc/agent_event_handlers/handle_ping_scan_event.py +++ b/monkey/monkey_island/cc/agent_event_handlers/handle_ping_scan_event.py @@ -37,17 +37,17 @@ class handle_ping_scan_event: return try: - dest_machine = self._get_destination_machine(event) + target_machine = self._get_target_machine(event) - self._update_destination_machine_os(dest_machine, event) - self._update_nodes(dest_machine, event) + self._update_target_machine_os(target_machine, event) + self._update_nodes(target_machine, event) except (RetrievalError, StorageError, TypeError, UnknownRecordError): logger.exception("Unable to process ping scan data") - def _get_destination_machine(self, event: PingScanEvent) -> Machine: + def _get_target_machine(self, event: PingScanEvent) -> Machine: try: - dest_machines = self._machine_repository.get_machines_by_ip(event.target) - return dest_machines[0] + target_machines = self._machine_repository.get_machines_by_ip(event.target) + return target_machines[0] except UnknownRecordError: machine = Machine( id=self._machine_repository.get_new_id(), @@ -56,17 +56,17 @@ class handle_ping_scan_event: self._machine_repository.upsert_machine(machine) return machine - def _update_destination_machine_os(self, machine: Machine, event: PingScanEvent): + def _update_target_machine_os(self, machine: Machine, event: PingScanEvent): if event.os is not None and machine.operating_system is None: machine.operating_system = event.os self._machine_repository.upsert_machine(machine) - def _update_nodes(self, dest_machine, event): + def _update_nodes(self, target_machine, event): src_machine = self._get_source_machine(event) # Update or create the node self._node_repository.upsert_communication( - src_machine.id, dest_machine.id, CommunicationType.SCANNED + src_machine.id, target_machine.id, CommunicationType.SCANNED ) def _get_source_machine(self, event: PingScanEvent) -> Machine: