From f39738fc2c761812adbdcd807d0d3dfd4a289aac Mon Sep 17 00:00:00 2001 From: Alex <61382599+NeffIsBack@users.noreply.github.com> Date: Tue, 4 Jul 2023 13:25:42 +0200 Subject: [PATCH] Revert #26 and fix #28 --- cme/connection.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/cme/connection.py b/cme/connection.py index 1b31f62c..be0a2902 100755 --- a/cme/connection.py +++ b/cme/connection.py @@ -262,24 +262,18 @@ class connection(object): else: domain_single = self.args.domain if hasattr(self.args, "domain") and self.args.domain else self.domain username_single = line - if "." not in domain_single: - self.logger.error(f"Domain {domain_single} for user {username_single.rstrip()} need to be FQDN ex:domain.local, not domain") - else: - domain.append(domain_single) - username.append(username_single.strip()) - owned.append(False) + domain.append(domain_single) + username.append(username_single.strip()) + owned.append(False) else: if "\\" in user: domain_single, username_single = user.split("\\") else: domain_single = self.args.domain if hasattr(self.args, "domain") and self.args.domain else self.domain username_single = user - if "." not in domain_single: - self.logger.error(f"Domain {domain_single} for user {username_single} need to be FQDN ex:domain.local, not domain") - else: - domain.append(domain_single) - username.append(username_single) - owned.append(False) + domain.append(domain_single) + username.append(username_single) + owned.append(False) # Parse passwords for password in self.args.password: @@ -330,6 +324,10 @@ class connection(object): return False if self.args.continue_on_success and owned: return False + # Enforcing FQDN for SMB if not using local authentication. Related issues/PRs: #26, #28, #24 + if self.args.protocol == 'smb' and not self.args.local_auth and "." not in domain: + self.logger.error(f"Domain {domain} for user {username.rstrip()} need to be FQDN ex:domain.local, not domain") + return False with sem: if cred_type == 'plaintext':