fix for kerberoast function

This commit is contained in:
mpgn
2022-10-22 16:38:29 -04:00
parent 7e0613c883
commit ed2b2b261a
2 changed files with 13 additions and 7 deletions
+4 -1
View File
@@ -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:
+9 -6
View File
@@ -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$")