Skip to content

Commit

Permalink
Fixed unicode issues on login when using ntlmV1 fallback
Browse files Browse the repository at this point in the history
Fixes #1419
  • Loading branch information
alexisbalbachan committed Oct 12, 2023
1 parent 663cc9b commit b15d0d5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion impacket/smb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit b15d0d5

Please sign in to comment.