Python 通过ldap进行ad域账号的校验。
首先需要安装python-ldap的模块 www.python-ldap.org/。 在这里用的是windows系统,当然比较容易,下载地址 pypi.python.org/pypi/python…
安装后在python 的交互环境里输入import ldap 如果没有问题就说明安装成功了。
Windows 无法安装 python-ldap 时,详见:xiexianbin.cn/python/2018…
python-ldap 3行集成域认证
import ldap
conn = ldap.initialize('ldap://host')
conn.simple_bind_s('domain\username', 'password')
注意验证时传空值验证也是可以通过的,注意要对password进行检查。
ldap3
from ldap3 import Server,Connection,ALL,NTLM
server = Server('192.168.10.1',get_info=ALL)
conn = Connection(server,user='Domain\\user', password='xxxxxxx',auto_bind=True,authentication='NTLM')
Apache Directory Studio连接Windows AD域控制器
参考链接:
传空值验证也是可以通过的
Python-LDAP增删改查
Python使用LDAP做用户认证