1
1
Fork 0

modified getmailad.py to get actually all enabled users

This commit is contained in:
David 2012-07-03 18:42:08 +02:00
parent 8897fd4bfd
commit 24a0c36f6f
1 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,13 @@
#!/usr/bin/python2 -B
#resources
#http://www.netvision.com/ad_useraccountcontrol.php
#http://fsuid.fsu.edu/admin/lib/WinADLDAPAttributes.html#RANGE!B28
#author: david@socialnerds.org
class getmailad(object):
""" get all email addresses from enabled
@ -37,7 +45,7 @@ class getmailad(object):
counter = 0
for item in result:
if item[1].has_key("userAccountControl"):
if item[1]["userAccountControl"] == ["512"] or item[1]["userAccountControl"] == ["66048"]:
if item[1]["userAccountControl"] == ["512"] or item[1]["userAccountControl"] == ["66048"] or item[1]["userAccountControl"] == ["66080"] or item[1]["userAccountControl"] == ["544"] or item[1]["userAccountControl"] == ["262656"] or item[1]["userAccountControl"] == ["262688"] or item[1]["userAccountControl"] == ["328192"] or item[1]["userAccountControl"] == ["328224"]:
if item[1].has_key("proxyAddresses"):
addresslist = item[1]["proxyAddresses"]
for address in addresslist:
@ -57,7 +65,7 @@ class getmailad(object):
if __name__ == "__main__":
getmailadobj = getmailad("ldap://dc2.aec.at", "davidsa@aec.at", "secret", "ou=adm,dc=aec,dc=at")
getmailadobj = getmailad("ldap://dc2.aec.at", "davidsa@aec.at", "secret", "ou=users,ou=adm,dc=aec,dc=at")
getmailadobj.get()
for item in getmailadobj.addresslist:
print item