From 06cbb3515813a3fad2347ac99ed6689993a32c0c Mon Sep 17 00:00:00 2001 From: Xiaoli Chan <2209553467@qq.com> Date: Mon, 6 Nov 2023 13:48:28 +0800 Subject: [PATCH] [winrm] ugly if condition Signed-off-by: Xiaoli Chan <2209553467@qq.com> --- nxc/protocols/winrm.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/nxc/protocols/winrm.py b/nxc/protocols/winrm.py index f40de015..d0a3aa45 100644 --- a/nxc/protocols/winrm.py +++ b/nxc/protocols/winrm.py @@ -87,20 +87,9 @@ class winrm(connection): # In winrm, auth without domain is equal local auth # If use "local-user@hostname", it will fail - if self.args.local_auth: + if self.args.local_auth or self.domain == self.hostname or self.domain is None: self.local_auth = True self.domain = "" - - # Switch into local auth - if self.domain == self.hostname: - self.local_auth = True - self.doamin = "" - - if self.server_os is None: - self.server_os = "" - - if self.domain is None: - self.domain = "" self.output_filename = os.path.expanduser(f"~/.nxc/logs/{self.hostname}_{self.host}_{datetime.now().strftime('%Y-%m-%d_%H%M%S')}".replace(":", "-")) @@ -250,7 +239,6 @@ class winrm(connection): self.password = password self.username = username self.domain = domain - try: self.conn = Client( self.host,