Agent: Initialize _agent_event_serializer_registry in __init__()

This commit is contained in:
Mike Salvatore 2022-09-20 10:05:47 -04:00
parent eea7fc1ee2
commit e9433ad23b
1 changed files with 3 additions and 2 deletions

View File

@ -107,9 +107,12 @@ logging.getLogger("urllib3").setLevel(logging.INFO)
class InfectionMonkey:
def __init__(self, args):
logger.info("Monkey is initializing...")
self._singleton = SystemSingleton()
self._opts = self._get_arguments(args)
self._agent_event_serializer_registry = self._setup_agent_event_serializers()
# TODO: Revisit variable names
server, island_api_client = self._connect_to_island_api()
# TODO: `address_to_port()` should return the port as an integer.
@ -207,8 +210,6 @@ class InfectionMonkey:
if firewall.is_enabled():
firewall.add_firewall_rule()
self._agent_event_serializer_registry = self._setup_agent_event_serializers()
self._control_channel = ControlChannel(self._control_client.server_address, GUID)
self._control_channel.register_agent(self._opts.parent)