Agent: Fix SSH exploiter to be able to exploit unknown OS

Previously if the agent couldn't detect the OS, agent failed with errors
This commit is contained in:
vakarisz 2022-09-14 17:08:52 +03:00
parent d509ee7216
commit f3fd2fca8b
1 changed files with 3 additions and 1 deletions

View File

@ -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}"