From d30dfd33963ad9d931c921be894eb49a5380a057 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 13 Sep 2022 15:16:27 -0400 Subject: [PATCH] Agent: Setup EventSerializerRegistry --- monkey/infection_monkey/monkey.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/monkey/infection_monkey/monkey.py b/monkey/infection_monkey/monkey.py index abb0964ca..8a5c4e26b 100644 --- a/monkey/infection_monkey/monkey.py +++ b/monkey/infection_monkey/monkey.py @@ -11,6 +11,10 @@ from pubsub.core import Publisher import infection_monkey.tunnel as tunnel from common.event_queue import IAgentEventQueue, PyPubSubAgentEventQueue +from common.event_serializers import ( + EventSerializerRegistry, + register_common_agent_event_serializers, +) from common.events import CredentialsStolenEvent from common.network.network_utils import address_to_ip_port from common.utils.argparse_types import positive_int @@ -172,6 +176,8 @@ class InfectionMonkey: if firewall.is_enabled(): firewall.add_firewall_rule() + _ = self._setup_agent_event_serializers() + control_channel = ControlChannel( self._control_client.server_address, GUID, self._control_client.proxies ) @@ -194,6 +200,13 @@ class InfectionMonkey: register_signal_handlers(self._master) + # TODO: This is just a placeholder for now. We will modify/integrate it with PR #2279. + def _setup_agent_event_serializers(self) -> EventSerializerRegistry: + agent_event_serializer_registry = EventSerializerRegistry() + register_common_agent_event_serializers(agent_event_serializer_registry) + + return agent_event_serializer_registry + def _build_master(self): local_network_interfaces = InfectionMonkey._get_local_network_interfaces()