From e2bc4bdd97891cf064d4fa5172ecd4dc9d2997c7 Mon Sep 17 00:00:00 2001 From: XiaoliChan <2209553467@qq.com> Date: Tue, 31 Oct 2023 21:43:36 +0800 Subject: [PATCH] [winrm] platform check when doing kerberos auth Signed-off-by: XiaoliChan <2209553467@qq.com> --- nxc/protocols/winrm.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/nxc/protocols/winrm.py b/nxc/protocols/winrm.py index 7dfa8a2c..88588fda 100644 --- a/nxc/protocols/winrm.py +++ b/nxc/protocols/winrm.py @@ -5,6 +5,7 @@ import requests import urllib3 import tempfile import contextlib +import platform import xml.etree.ElementTree as ET from io import StringIO @@ -43,6 +44,20 @@ class winrm(connection): connection.__init__(self, args, db, host) + def proto_flow(self): + if self.kerberos and (platform.system() != "Linux"): + self.logger.info("Doing kerberos auth with WINRM only support Linux platform!") + return False + self.proto_logger() + if self.create_conn_obj(): + self.enum_host_info() + self.print_host_info() + if self.login(): + if hasattr(self.args, "module") and self.args.module: + self.call_modules() + else: + self.call_cmd_args() + def proto_logger(self): self.logger = NXCAdapter( extra={ @@ -496,4 +511,4 @@ class winrm(connection): perSecretCallback=lambda secret_type, secret: self.logger.highlight(secret), ) LSA.dumpCachedHashes() - LSA.dumpSecrets() + LSA.dumpSecrets() \ No newline at end of file