Advertisement
Guest User

Untitled

a guest
Mar 9th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. from ldap3 import Server, Connection, ALL
  2. import getpass
  3.  
  4. #admin = input("Please enter your Adminname: ")
  5. #passwort = getpass.getpass("Please provide your Passwort: ")
  6. #user = input("Wie lautet der Name des User nach welchem gesucht wird?:(Nachname) ")
  7.  
  8. #filterS = search_filter('&(givenName=' + user +'*')
  9. #search_base = 'dc=ZTG,dc=Users,dc=Employees')
  10. admin='admin_kamo'
  11. passwort = '3Ilovefood!3'
  12.  
  13. ads_server = Server('kronos.ads.zuehlke.com', use_ssl=True, get_info=ALL)
  14. connection = Connection(ads_server, user = 'ads\\'+admin ,password=passwort,auto_bind=True)
  15.  
  16. #connection.search('DC=ads,DC=zuehlke,DC=com,DC=ZTG,DC=Users,DC=Employees','&(objectclass=person')())
  17. connection.search('DC=ads,DC=zuehlke,DC=com, ou=ZTG,ou=Users,ou=Employees', '(&(objectclass=person)(sn=moutiq))', attributes=['samAccountName'])
  18. print(connection.entries)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement