Skip to content

Commit

Permalink
Set channel binding to bytes value as requested in the review
Browse files Browse the repository at this point in the history
  • Loading branch information
NeffIsBack committed Nov 2, 2024
1 parent 3232ec0 commit ed69c9d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions impacket/ntlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@


def computeResponse(flags, serverChallenge, clientChallenge, serverName, domain, user, password, lmhash='', nthash='',
use_ntlmv2=USE_NTLMv2, channel_binding_value=''):
use_ntlmv2=USE_NTLMv2, channel_binding_value=b''):
if use_ntlmv2:
return computeResponseNTLMv2(flags, serverChallenge, clientChallenge, serverName, domain, user, password,
lmhash, nthash, use_ntlmv2=use_ntlmv2, channel_binding_value=channel_binding_value)
Expand Down Expand Up @@ -594,7 +594,7 @@ def getNTLMSSPType1(workstation='', domain='', signingRequired = False, use_ntlm

return auth

def getNTLMSSPType3(type1, type2, user, password, domain, lmhash = '', nthash = '', use_ntlmv2 = USE_NTLMv2, channel_binding_value = ''):
def getNTLMSSPType3(type1, type2, user, password, domain, lmhash = '', nthash = '', use_ntlmv2 = USE_NTLMv2, channel_binding_value = b''):

# Safety check in case somebody sent password = None.. That's not allowed. Setting it to '' and hope for the best.
if password is None:
Expand Down Expand Up @@ -898,7 +898,7 @@ def LMOWFv2( user, password, domain, lmhash = ''):


def computeResponseNTLMv2(flags, serverChallenge, clientChallenge, serverName, domain, user, password, lmhash='',
nthash='', use_ntlmv2=USE_NTLMv2, channel_binding_value=''):
nthash='', use_ntlmv2=USE_NTLMv2, channel_binding_value=b''):

responseServerVersion = b'\x01'
hiResponseServerVersion = b'\x01'
Expand All @@ -920,10 +920,6 @@ def computeResponseNTLMv2(flags, serverChallenge, clientChallenge, serverName, d
else:
aTime = b'\x00'*8

if channel_binding_value is None:
channel_binding_value = b''
elif isinstance(channel_binding_value, str):
channel_binding_value = channel_binding_value.encode()
if len(channel_binding_value) > 0:
av_pairs[NTLMSSP_AV_CHANNEL_BINDINGS] = channel_binding_value

Expand Down

0 comments on commit ed69c9d

Please sign in to comment.