python3测试AD用户账号密码

from ldap3 import Server,Connection,ALL,NTLM
def ldap_connect(server,user,password):
    AD_server=Server(server,get_info=ALL)
    try:
        conn=Connection(AD_server,user=user,password=password,auto_bind=True,authentication=NTLM)
    except Exception as e:
        print("Login Error ! \f",*(e.args))
    else:
        print("Login Successful !")
        return conn
   
conn=ldap_connect(server='DASHBRANDS.local',user=r'DASHBRANDS\test',password=r'passwd')
需要ldap3库,

传入AD地址,用户名,密码即可

上一篇:数据采集第二次实践


下一篇:关于使用python解决excel遍历以及导入数据库 + python读取数据库保存excel/.csv文件 的说明