From 6fc8d393314cfbf8d0b882e80e3257045f08c36b Mon Sep 17 00:00:00 2001 From: lefayjey Date: Tue, 28 Nov 2023 15:00:05 +0100 Subject: [PATCH] Update ldap.py Fix issue to password/hash authentication after adding kerberos check. Sorry for that --- sectools/windows/ldap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sectools/windows/ldap.py b/sectools/windows/ldap.py index 370a1f5..b985247 100644 --- a/sectools/windows/ldap.py +++ b/sectools/windows/ldap.py @@ -145,9 +145,9 @@ def __init_ldap_connection(target, tls_version, dc_ip, domain, username, passwor ldap_session = ldap3.Connection(ldap_server) ldap_session.bind() ldap3_kerberos_login(ldap_session, target, username, password, domain, lmhash, nthash, aeskey, kdcHost) - elif nthash is not None: + elif len(nthash) != 0: if len(lmhash) == 0: - lmhash = "aad3b435b51404eeaad3b435b51404ee" + lmhash = "aad3b435b51404eeaad3b435b51404ee" ldap_session = ldap3.Connection(ldap_server, user=user, password=lmhash + ":" + nthash, authentication=ldap3.NTLM, auto_bind=True) else: ldap_session = ldap3.Connection(ldap_server, user=user, password=password, authentication=ldap3.NTLM, auto_bind=True)