Agent: Use AgentEventSerializerRegistry in place of EventSerializerRegistry

This commit is contained in:
Shreya Malviya 2022-09-16 12:27:08 +05:30 committed by Mike Salvatore
parent 6ced4af5dc
commit 19a59bf3c2
2 changed files with 6 additions and 6 deletions

View File

@ -6,7 +6,7 @@ from time import sleep
import requests import requests
from common.common_consts.timeouts import MEDIUM_REQUEST_TIMEOUT from common.common_consts.timeouts import MEDIUM_REQUEST_TIMEOUT
from common.event_serializers import EventSerializerRegistry, JSONSerializable from common.event_serializers import AgentEventSerializerRegistry, JSONSerializable
from common.events import AbstractAgentEvent from common.events import AbstractAgentEvent
from infection_monkey.utils.threading import create_daemon_thread from infection_monkey.utils.threading import create_daemon_thread
@ -23,7 +23,7 @@ class AgentEventForwarder:
""" """
def __init__( def __init__(
self, server_address: str, agent_event_serializer_registry: EventSerializerRegistry self, server_address: str, agent_event_serializer_registry: AgentEventSerializerRegistry
): ):
self._server_address = server_address self._server_address = server_address
self._agent_event_serializer_registry = agent_event_serializer_registry self._agent_event_serializer_registry = agent_event_serializer_registry

View File

@ -11,7 +11,7 @@ from pubsub.core import Publisher
from common.event_queue import IAgentEventQueue, PyPubSubAgentEventQueue from common.event_queue import IAgentEventQueue, PyPubSubAgentEventQueue
from common.event_serializers import ( from common.event_serializers import (
EventSerializerRegistry, AgentEventSerializerRegistry,
register_common_agent_event_serializers, register_common_agent_event_serializers,
) )
from common.events import CredentialsStolenEvent from common.events import CredentialsStolenEvent
@ -213,8 +213,8 @@ class InfectionMonkey:
register_signal_handlers(self._master) register_signal_handlers(self._master)
# TODO: This is just a placeholder for now. We will modify/integrate it with PR #2279. # TODO: This is just a placeholder for now. We will modify/integrate it with PR #2279.
def _setup_agent_event_serializers(self) -> EventSerializerRegistry: def _setup_agent_event_serializers(self) -> AgentEventSerializerRegistry:
agent_event_serializer_registry = EventSerializerRegistry() agent_event_serializer_registry = AgentEventSerializerRegistry()
register_common_agent_event_serializers(agent_event_serializer_registry) register_common_agent_event_serializers(agent_event_serializer_registry)
return agent_event_serializer_registry return agent_event_serializer_registry
@ -259,7 +259,7 @@ class InfectionMonkey:
event_queue: IAgentEventQueue, event_queue: IAgentEventQueue,
propagation_credentials_repository: IPropagationCredentialsRepository, propagation_credentials_repository: IPropagationCredentialsRepository,
server_address: str, server_address: str,
agent_event_serializer_registry: EventSerializerRegistry, agent_event_serializer_registry: AgentEventSerializerRegistry,
): ):
event_queue.subscribe_type( event_queue.subscribe_type(
CredentialsStolenEvent, CredentialsStolenEvent,