Welcome to msldap’s documentation!¶
Basic example¶
All basic examples will fetch the user object of the user Administrator and print out the attributes
The difference is the type of authentication and security settings which are controlled by the url parameter
This module supports a wide variety of authentication and channel protection mechanisms, check the Tutorials!
import asyncio
from msldap.commons.factory import LDAPConnectionFactory
url = 'ldap+simple://TEST\\victim:Passw0rd!1@10.10.10.2'
async def client(url):
conn_url = LDAPConnectionFactory.from_url(url)
ldap_client = conn_url.get_client()
_, err = await ldap_client.connect()
if err is not None:
raise err
user = await ldap_client.get_user('Administrator')
print(str(user))
if __name__ == '__main__':
asyncio.run(client(url))