From 10ee9f9e75cce70a96ac5bdedfc22b5de2e10a6d Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 16 Feb 2022 14:57:05 -0500 Subject: [PATCH] Agent: Do not run SSHCredentialsCollector if the OS is not Linux --- .../credential_collectors/ssh_collector/ssh_handler.py | 7 +++++++ 1 file changed, 7 insertions(+) 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 8c635d92b..89f3c34fc 100644 --- a/monkey/infection_monkey/credential_collectors/ssh_collector/ssh_handler.py +++ b/monkey/infection_monkey/credential_collectors/ssh_collector/ssh_handler.py @@ -8,6 +8,7 @@ from common.utils.attack_utils import ScanStatus from infection_monkey.telemetry.attack.t1005_telem import T1005Telem from infection_monkey.telemetry.attack.t1145_telem import T1145Telem from infection_monkey.telemetry.messengers.i_telemetry_messenger import ITelemetryMessenger +from infection_monkey.utils.environment import is_windows_os logger = logging.getLogger(__name__) @@ -15,6 +16,12 @@ DEFAULT_DIRS = ["/.ssh/", "/"] def get_ssh_info(telemetry_messenger: ITelemetryMessenger) -> Iterable[Dict]: + if is_windows_os(): + logger.debug( + "Skipping SSH credentials collection because the operating system is not Linux" + ) + return [] + home_dirs = _get_home_dirs() ssh_info = _get_ssh_files(home_dirs, telemetry_messenger)