MCPcopy Index your code
hub / github.com/XiaoliChan/LDAPShell / ldap_connection

Method ldap_connection

ldapshell.py:34–49  ·  view source on GitHub ↗
(self, tls_version)

Source from the content-addressed store, hash-verified

32 self.lmhash = "aad3b435b51404eeaad3b435b51404ee"
33
34 def ldap_connection(self, tls_version):
35 user_withDomain = '%s\\%s' % (self.domain, self.username)
36 if tls_version is not None:
37 use_ssl = True
38 port = 636
39 tls = ldap3.Tls(validate=ssl.CERT_NONE, version=tls_version)
40 else:
41 use_ssl = False
42 port = 389
43 tls = None
44 ldap_server = ldap3.Server(self.address, get_info=ldap3.ALL, port=port, use_ssl=use_ssl, tls=tls)
45 if self.nthash != "":
46 ldap_session = ldap3.Connection(ldap_server, user=user_withDomain, password=self.lmhash + ":" + self.nthash, authentication=ldap3.NTLM, auto_bind=True)
47 else:
48 ldap_session = ldap3.Connection(ldap_server, user=user_withDomain, password=self.password, authentication=ldap3.NTLM, auto_bind=True)
49 return ldap_server, ldap_session
50
51 # For ldap3 with tls mode(only for ldap3).
52 # Picked function from rbcd.py

Callers 1

ldap_sessionsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected