if ldaps then ldaps my friend

main
mpgn 2023-02-12 16:11:22 -05:00
parent 59e0e6b340
commit 8c5f25a2db
1 changed files with 2 additions and 1 deletions

View File

@ -185,7 +185,8 @@ class ldap(connection):
def get_ldap_info(self, host): def get_ldap_info(self, host):
try: try:
ldapConnection = ldap_impacket.LDAPConnection('ldap://%s' % host) proto = "ldaps" if (self.args.gmsa or self.args.port == 636) else "ldap"
ldapConnection = ldap_impacket.LDAPConnection(proto + '://%s' % host)
resp = ldapConnection.search(scope=ldapasn1_impacket.Scope('baseObject'), attributes=['defaultNamingContext', 'dnsHostName'], sizeLimit=0) resp = ldapConnection.search(scope=ldapasn1_impacket.Scope('baseObject'), attributes=['defaultNamingContext', 'dnsHostName'], sizeLimit=0)
for item in resp: for item in resp: