diff --git a/monkey/infection_monkey/credential_collectors/ssh_collector/ssh_credential_collector.py b/monkey/infection_monkey/credential_collectors/ssh_collector/ssh_credential_collector.py index ed0fc1a8e..d4c1c84da 100644 --- a/monkey/infection_monkey/credential_collectors/ssh_collector/ssh_credential_collector.py +++ b/monkey/infection_monkey/credential_collectors/ssh_collector/ssh_credential_collector.py @@ -15,13 +15,15 @@ class SSHCredentialCollector(ICredentialCollector): SSH keys credential collector """ - def __init__(self, telemetry_messenger: ITelemetryMessenger, event_queue: IAgentEventQueue): + def __init__( + self, telemetry_messenger: ITelemetryMessenger, agent_event_queue: IAgentEventQueue + ): self._telemetry_messenger = telemetry_messenger - self._event_queue = event_queue + self._agent_event_queue = agent_event_queue def collect_credentials(self, _options=None) -> Sequence[Credentials]: logger.info("Started scanning for SSH credentials") - ssh_info = ssh_handler.get_ssh_info(self._telemetry_messenger, self._event_queue) + ssh_info = ssh_handler.get_ssh_info(self._telemetry_messenger, self._agent_event_queue) logger.info("Finished scanning for SSH credentials") return ssh_handler.to_credentials(ssh_info) diff --git a/monkey/infection_monkey/credential_collectors/ssh_collector/ssh_handler.py b/monkey/infection_monkey/credential_collectors/ssh_collector/ssh_handler.py index 047ee9e7b..3776ce8ef 100644 --- a/monkey/infection_monkey/credential_collectors/ssh_collector/ssh_handler.py +++ b/monkey/infection_monkey/credential_collectors/ssh_collector/ssh_handler.py @@ -34,7 +34,7 @@ SSH_COLLECTOR_EVENT_TAGS = frozenset( def get_ssh_info( - telemetry_messenger: ITelemetryMessenger, event_queue: IAgentEventQueue + telemetry_messenger: ITelemetryMessenger, agent_event_queue: IAgentEventQueue ) -> Iterable[Dict]: # TODO: Remove this check when this is turned into a plugin. if is_windows_os(): @@ -44,7 +44,7 @@ def get_ssh_info( return [] home_dirs = _get_home_dirs() - ssh_info = _get_ssh_files(home_dirs, telemetry_messenger, event_queue) + ssh_info = _get_ssh_files(home_dirs, telemetry_messenger, agent_event_queue) return ssh_info @@ -85,7 +85,7 @@ def _get_ssh_struct(name: str, home_dir: str) -> Dict: def _get_ssh_files( user_info: Iterable[Dict], telemetry_messenger: ITelemetryMessenger, - event_queue: IAgentEventQueue, + agent_event_queue: IAgentEventQueue, ) -> Iterable[Dict]: for info in user_info: path = info["home_dir"] @@ -127,7 +127,7 @@ def _get_ssh_files( collected_credentials = to_credentials([info]) _publish_credentials_stolen_event( - collected_credentials, event_queue + collected_credentials, agent_event_queue ) else: continue @@ -172,7 +172,7 @@ def to_credentials(ssh_info: Iterable[Dict]) -> Sequence[Credentials]: def _publish_credentials_stolen_event( - collected_credentials: Sequence[Credentials], event_queue: IAgentEventQueue + collected_credentials: Sequence[Credentials], agent_event_queue: IAgentEventQueue ): credentials_stolen_event = CredentialsStolenEvent( source=get_agent_id(), @@ -180,4 +180,4 @@ def _publish_credentials_stolen_event( stolen_credentials=collected_credentials, ) - event_queue.publish(credentials_stolen_event) + agent_event_queue.publish(credentials_stolen_event)