From ed2b2b261ada1bce1fdd0c10a70efba18e98866b Mon Sep 17 00:00:00 2001 From: mpgn Date: Sat, 22 Oct 2022 16:38:29 -0400 Subject: [PATCH] fix for kerberoast function --- cme/protocols/ldap.py | 5 ++++- cme/protocols/smb.py | 15 +++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cme/protocols/ldap.py b/cme/protocols/ldap.py index 4abc31a1..11297d78 100644 --- a/cme/protocols/ldap.py +++ b/cme/protocols/ldap.py @@ -240,6 +240,9 @@ class ldap(connection): def kerberos_login(self, domain, username, password = '', ntlm_hash = '', aesKey = '', kdcHost = '', useCache = False): self.logger.extra['protocol'] = "LDAP" self.logger.extra['port'] = "389" + self.username = username + self.password = password + self.domain = domain # Get ldap info (target, targetDomain, baseDN) target, self.targetDomain, self.baseDN = self.get_ldap_info(self.host) @@ -741,7 +744,6 @@ class ldap(connection): self.logger.highlight("No entries found!") elif resp: answers = [] - self.logger.info('Total of records returned %d' % len(resp)) for item in resp: if isinstance(item, ldapasn1_impacket.SearchResultEntry) is not True: @@ -792,6 +794,7 @@ class ldap(connection): pass if len(answers)>0: + self.logger.info('Total of records returned %d' % len(answers)) TGT = KerberosAttacks(self).getTGT_kerberoasting() dejavue = [] for SPN, sAMAccountName, memberOf, pwdLastSet, lastLogon, delegation in answers: diff --git a/cme/protocols/smb.py b/cme/protocols/smb.py index 58ba88da..8a7407a5 100755 --- a/cme/protocols/smb.py +++ b/cme/protocols/smb.py @@ -253,13 +253,16 @@ class smb(connection): try: self.conn.login('' , '') - except: - #if "STATUS_ACCESS_DENIED" in e: + self.domain = self.conn.getServerDNSDomainName() + self.hostname = self.conn.getServerName() + self.server_os = self.conn.getServerOS() + except Exception as e: + if "STATUS_NOT_SUPPORTED" in str(e): + # no ntlm supported + self.domain = self.args.domain + self.hostname = self.host pass - self.domain = self.conn.getServerDNSDomainName() - self.hostname = self.conn.getServerName() - self.server_os = self.conn.getServerOS() try: self.signing = self.conn.isSigningRequired() if self.smbv1 else self.conn._SMBConnection._Connection['RequireSigning'] except: @@ -358,7 +361,7 @@ class smb(connection): # self.check_if_admin() # currently pywerview does not support kerberos auth - except SessionError as e: + except (SessionError, Exception) as e: error = e try: self.conn.connectTree("C$")