From f3fd2fca8be5399f2f0a98fdc5be9fb68d06ecdf Mon Sep 17 00:00:00 2001 From: vakarisz Date: Wed, 14 Sep 2022 17:08:52 +0300 Subject: [PATCH] Agent: Fix SSH exploiter to be able to exploit unknown OS Previously if the agent couldn't detect the OS, agent failed with errors --- monkey/infection_monkey/exploit/sshexec.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monkey/infection_monkey/exploit/sshexec.py b/monkey/infection_monkey/exploit/sshexec.py index 7de9b26ce..1b317b2ac 100644 --- a/monkey/infection_monkey/exploit/sshexec.py +++ b/monkey/infection_monkey/exploit/sshexec.py @@ -4,6 +4,7 @@ from pathlib import PurePath import paramiko +from common import OperatingSystem from common.common_consts.timeouts import LONG_REQUEST_TIMEOUT, MEDIUM_REQUEST_TIMEOUT from common.credentials.credentials import get_plaintext from common.utils import Timer @@ -181,7 +182,8 @@ class SSHExploiter(HostExploiter): _, stdout, _ = ssh.exec_command("uname -o", timeout=SSH_EXEC_TIMEOUT) uname_os = stdout.read().lower().strip().decode() if "linux" in uname_os: - self.exploit_result.os = "linux" + self.exploit_result.os = OperatingSystem.LINUX + self.host.os["type"] = OperatingSystem.LINUX else: self.exploit_result.error_message = f"SSH Skipping unknown os: {uname_os}"