msldap是一款用于审计MS AD的LDAP库,广大研究人员可以利用该工具轻松执行针对MS AD的安全审计任务。
1、配有内置控制台 LDAP 客户端;
2、所有参数都可以通过方便的 URL 进行控制;
3、支持与 NTLM 和 KERBEROS 集成的 Windows 身份验证 (SSPI);
4、支持通道绑定(适用于 ntlm 和 kerberos,不适用于 SSPI);
5、支持加密(针对 NTLM/KERBEROS/SSPI);
6、支持 LDAPS(TODO:实际验证证书);
7、支持SOCKS5代理,无需额外的代理程序;
8、最小占用空间;
9、大量预建查询,方便信息轮询;
10、轻松集成到您的项目中;
asn1crypto
asysocks
aiocmd
asciitree
由于该工具基于Python 3.6开发,因此我们首先需要在本地设备上安装并配置好最新版本的Python 3.6+环境。
接下来,广大研究人员可以直接使用下列命令将该项目源码克隆至本地:
然后切换到项目目录中,使用工具安装脚本完成安装:
cd msldap
python3 setup.py install
pip安装
+:
sets the ldap protocol following values supported:
- ldap
- ldaps
- gc
- gc_ssl
can be omitted if plaintext authentication is to be performed (in that case it default to ntlm-password), otherwise:
- ntlm-password
- ntlm-nt
- kerberos-password (dc option param must be used)
- kerberos-rc4 / kerberos-nt (dc option param must be used)
- kerberos-aes (dc option param must be used)
- kerberos-keytab (dc option param must be used)
- kerberos-ccache (dc option param must be used)
- kerberos-pfx (dc option param must be used)
- kerberos-pem (dc option param must be used)
- kerberos-certstore (dc option param must be used, windows only)
- sspi-ntlm (windows only!)
- sspi-kerberos (windows only!)
- anonymous
- plain
- simple
- sicily (same format as ntlm-nt but using the SICILY authentication)
:
OPTIONAL. Specifies the root tree of all queries
can be:
- timeout : connction timeout in seconds
- proxytype: currently only socks5 proxy is supported
- proxyhost: Ip or hostname of the proxy server
- proxyport: port of the proxy server
- proxytimeout: timeout ins ecodns for the proxy connection
- dc: the IP address of the domain controller, MUST be used for kerberos authentication
Examples:
ldap:
ldaps:
ldap+sspi-ntlm:
ldap+sspi-kerberos:
ldap:
ldap+simple:
ldap+plain:
ldap+ntlm-password:
ldap+ntlm-nt:
ldap+kerberos-password:
ldap+kerberos-rc4:
ldap+kerberos-aes:
ldap:
ldap:
模块使用
import asyncio
from msldap.commons.factory import LDAPConnectionFactory
url = 'ldap+simple://TEST\\victim:[email protected]'
async def client(url):
conn_url = LDAPConnectionFactory.from_url(url)
ldap_client = conn_url.get_client()
_, err = await ldap_client.connect()
if err is not None:
raise err
user = await ldap_client.get_user('Administrator')
print(str(user))
if __name__ == '__main__':
asyncio.run(client(url))
本项目的开发与发布遵循MIT开源许可协议。
msldap:
https://github.com/skelsec/msldap
https://msldap.readthedocs.io/en/latest/https://live.octopwn.com/