Guest User

Untitled

a guest
Jun 14th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. LDAP_URL = "ldap://ldap-server.my-company.com"
  2. USER = "ldap-user"
  3. PASSWORD = "ldap-password"
  4.  
  5. conn = ldap.initialize(LDAP_URL)
  6. conn.simple_bind_s(USER, PASSWORD)
  7.  
  8. # the base_dn where you want to start the search, play with different params here
  9. base_dn = "OU=Users,DC=corp,DC=<your-company>,DC=com"
  10.  
  11. # search for the user with this attribute. Do a search for some user with this and then
  12. # looking at the output, you can add a more complex search with all the other
  13. # attributes that you see there.
  14. search_dn = "(sAMAccountName=user-id)"
  15. conn.search_s(base_dn, ldap.SCOPE_SUBTREE, search_dn)
Add Comment
Please, Sign In to add comment