Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions impacket/smb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3488,6 +3488,8 @@ def kerberos_login(self, user, password, domain = '', lmhash = '', nthash = '',
if TGT is None:
if TGS is None:
tgt, cipher, oldSessionKey, sessionKey = getKerberosTGT(userName, password, domain, lmhash, nthash, aesKey, kdcHost)
# Persist the TGT we just obtained so callers can reuse it through getCredentials()
self.__TGT = {'KDC_REP': tgt, 'cipher': cipher, 'sessionKey': sessionKey}
else:
tgt = TGT['KDC_REP']
cipher = TGT['cipher']
Expand All @@ -3498,6 +3500,8 @@ def kerberos_login(self, user, password, domain = '', lmhash = '', nthash = '',
if TGS is None:
serverName = Principal('cifs/%s' % self.__remote_name, type=constants.PrincipalNameType.NT_SRV_INST.value)
tgs, cipher, oldSessionKey, sessionKey = getKerberosTGS(serverName, domain, kdcHost, tgt, cipher, sessionKey)
# Persist the ST we just obtained so callers can reuse it through getCredentials()
self.__TGS = {'KDC_REP': tgs, 'cipher': cipher, 'sessionKey': sessionKey}
else:
tgs = TGS['KDC_REP']
cipher = TGS['cipher']
Expand Down
4 changes: 4 additions & 0 deletions impacket/smb3.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,8 @@ def kerberosLogin(self, user, password, domain = '', lmhash = '', nthash = '', a
if TGT is None:
if TGS is None:
tgt, cipher, oldSessionKey, sessionKey = getKerberosTGT(userName, password, domain, lmhash, nthash, aesKey, kdcHost)
# Persist the TGT we just obtained so callers can reuse it through getCredentials()
self.__TGT = {'KDC_REP': tgt, 'cipher': cipher, 'sessionKey': sessionKey}
else:
tgt = TGT['KDC_REP']
cipher = TGT['cipher']
Expand All @@ -769,6 +771,8 @@ def kerberosLogin(self, user, password, domain = '', lmhash = '', nthash = '', a
if TGS is None:
serverName = Principal('cifs/%s' % (self._Connection['ServerName']), type=constants.PrincipalNameType.NT_SRV_INST.value)
tgs, cipher, oldSessionKey, sessionKey = getKerberosTGS(serverName, domain, kdcHost, tgt, cipher, sessionKey)
# Persist the ST we just obtained so callers can reuse it through getCredentials()
self.__TGS = {'KDC_REP': tgs, 'cipher': cipher, 'sessionKey': sessionKey}
else:
tgs = TGS['KDC_REP']
cipher = TGS['cipher']
Expand Down
Loading