From 271475570de09b43b4127a46bd50c8879a51f505 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 21 Sep 2022 12:36:32 -0400 Subject: [PATCH] Island: Modify machine with AgentRegistrationData Since the Machine is passed to other methods, it should have the most up to date data. --- .../handle_agent_registration.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/monkey/monkey_island/cc/island_event_handlers/handle_agent_registration.py b/monkey/monkey_island/cc/island_event_handlers/handle_agent_registration.py index c9bf5f611..363335c5f 100644 --- a/monkey/monkey_island/cc/island_event_handlers/handle_agent_registration.py +++ b/monkey/monkey_island/cc/island_event_handlers/handle_agent_registration.py @@ -59,15 +59,11 @@ class handle_agent_registration: return None - def _upsert_machine( - self, existing_machine: Machine, agent_registration_data: AgentRegistrationData - ): - updated_machine = existing_machine.copy() + def _upsert_machine(self, machine: Machine, agent_registration_data: AgentRegistrationData): + self._update_hardware_id(machine, agent_registration_data) + self._update_network_interfaces(machine, agent_registration_data) - self._update_hardware_id(updated_machine, agent_registration_data) - self._update_network_interfaces(updated_machine, agent_registration_data) - - self._machine_repository.upsert_machine(updated_machine) + self._machine_repository.upsert_machine(machine) def _update_hardware_id(self, machine: Machine, agent_registration_data: AgentRegistrationData): if (