From b15d0d5d59e14452d69943dc39878180d616c325 Mon Sep 17 00:00:00 2001 From: Alexis Balbachan Date: Thu, 12 Oct 2023 02:19:02 -0300 Subject: [PATCH] Fixed unicode issues on login when using ntlmV1 fallback Fixes #1419 --- impacket/smb.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/impacket/smb.py b/impacket/smb.py index c56127806c..ac4d05ee6c 100644 --- a/impacket/smb.py +++ b/impacket/smb.py @@ -58,6 +58,7 @@ from impacket.structure import Structure from impacket.spnego import SPNEGO_NegTokenInit, TypesMech, SPNEGO_NegTokenResp, ASN1_OID, asn1encode, ASN1_AID from impacket.krb5.gssapi import KRB5_AP_REQ +import six # For signing import hashlib @@ -3495,7 +3496,8 @@ def login(self, user, password, domain = '', lmhash = '', nthash = '', ntlm_fall self.login_extended(user, password, domain, lmhash, nthash, use_ntlmv2 = True) except: # If the target OS is Windows 5.0 or Samba, let's try using NTLMv1 - if ntlm_fallback and ((self.get_server_lanman().find('Windows 2000') != -1) or (self.get_server_lanman().find('Samba') != -1)): + if ntlm_fallback and ((six.ensure_binary(self.get_server_lanman()).find(b'Windows 2000') != -1) or + (six.ensure_binary(self.get_server_lanman()).find(b'Samba') != -1)): self.login_extended(user, password, domain, lmhash, nthash, use_ntlmv2 = False) self.__isNTLMv2 = False else: