python - Python Ldap模块限制搜索1000个用户,如何使用简单搜索?
问题描述
我在 python 中使用 Ldap3 模块来查询 AD,但是如果广告帐户在前 1000 次搜索中我会得到结果,我在 AD 中有超过 25000 + 用户 ID,我如何将我的代码更改为简单的页面搜索,请帮助我。
''''
import sys
from ldap3 import Server, Connection, ALL, NTLM, ALL_ATTRIBUTES, ALL_OPERATIONAL_ATTRIBUTES, AUTO_BIND_NO_TLS, SUBTREE
from ldap3.core.exceptions import LDAPCursorError
server = Server('bluepedia.com',get_info=ALL)
conn = Connection(server, user='bluepedia\\administrator', password='Vihaan@2016', authentication=NTLM)
conn.bind()
fusers = ['vihaan','phani','rammohan','raja','bindu','MA977956', 'MA625841','gopal','govind','MA177397','MA259156']
status = ''
usermail= ''
format_string = '{:25} {:21} {}'
print(format_string.format('User ID', 'Account Status', 'E-mail Address'))
conn.search('dc=bluepedia,dc=com', '(objectclass=person)',attributes=['sAMAccountName', 'mail'])
for x in fusers:
for e in conn.entries:
usermail = e.mail
if x in e.sAMAccountName:
# status = 'active' +"\t\t\t\t"+ str(usermail)
status = 'active'
break
else:
status = "Not Active"
usermail = ''
print(format_string.format(str(x),str(status),str(usermail)))
''''
我需要的结果是我想使用 Ldap3 模块从列表中搜索用户 ID,并且列表中有 10000 个用户。
解决方案
推荐阅读
- html - 我正在用 HTML 和 CSS 制作一个圆环图,需要帮助将我的跨度放在楔子的中间
- regex - 正则表达式查找单个数字的单词
- vue.js - Vue.js 在输入中选择的值不匹配:selected 参数
- css - svg 不会缩放到全高,父 flex,flex-direction:列
- java - 如果 Java 8 样式中存在值,如何从 HashMap 中删除
- powershell - 连接“字符串 + 变量 + 字符串”导致“字符串 + System.Data.DataRow + 字符串”
- html - li:nth-child(x):hover 部分工作
- javascript - Extract generic type parameters from a string
- ruby-on-rails - 将 Mail::Part 保存为载波附件
- excel - 如何将excel文件复制到outlook文件夹中