msldap
Python library to play with MS LDAP
What it is and what it does
msldap is a library for programmatic interaction with Microsoft Active Directory through LDAP. It abstracts away the complexity of LDAP protocol details and AD-specific authentication schemes, letting you query users, groups, computers, and other directory objects with minimal boilerplate. The library supports a wide range of authentication methods—NTLM (password or hash), Kerberos (with multiple key types), SSPI (Windows-native), and anonymous/simple bind—all configured through a single connection URL string. It also includes a built-in interactive LDAP console for ad-hoc queries and supports SOCKS5 proxying for remote AD access.
The package depends on cryptographic and authentication libraries (unicrypto, asyauth, asysocks, asn1crypto) and UI helpers (prompt-toolkit, tqdm, tabulate) to handle the complexity of AD protocols and provide a polished command-line experience. It's designed as a library first, though it ships a command-line tool for interactive use. The codebase is stable but aging, with no formal test suite, so production use should be informed by your own validation.
Use it for:
- Enumerate users, groups, and computers in an Active Directory domain for security auditing or inventory purposes.
- Authenticate to AD-integrated services programmatically using NTLM or Kerberos without external dependencies.
- Query AD for certificate templates, certificate authorities, or other security-relevant objects.
- Perform AD reconnaissance through a SOCKS5 proxy when direct access to the domain controller is restricted.
- Build custom AD management or reporting tools that need to read directory data without relying on Windows-only APIs.
- Integrate AD queries into penetration testing or security research workflows.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
msldap is a Python library for querying and interacting with Microsoft Active Directory via LDAP, supporting multiple authentication methods including NTLM, Kerberos, SSPI, and anonymous bind.
Yes, if you need to query or authenticate against Microsoft Active Directory from Python and want a lightweight, flexible library with support for multiple auth schemes. The permissive MIT license and low install friction make it accessible. However, be aware that maintenance is aging (last release 446 days old), there is no formal test suite, and LDAPS certificate verification is incomplete—so validate thoroughly before using in security-critical production systems. For one-off AD queries or integration into security tools, it's a solid choice.
Install
msldap on PyPI
pip
pip install msldapuv
uv add msldappoetry
poetry add msldapInstalling msldap
Before you install
Low install friction with a pure-Python wheel distribution. Maintenance is aging—last commit was 2026-02-11 and the latest release 446 days old—but the repository remains active and unarchived with modest community interest (498 stars).
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute the library freely in both open-source and commercial projects without restriction.
Quickstart
pip install msldap
from msldap import MSLDAPClient
# Create a client with a connection URL
client = MSLDAPClient('ldap+ntlm-password://DOMAIN\\user:password@10.0.0.1')
# Query AD for users, groups, or other objects
Requires Python 3.7 or later. For Kerberos authentication, the domain controller IP must be specified via the 'dc' parameter in the connection URL.
Verify before relying
- Whether LDAPS certificate verification is actually implemented (description notes 'TODO: actually verify certificate').
- Current test coverage and stability guarantees (description explicitly states 'No testing suite').
- Whether all advertised authentication methods (especially Kerberos variants) are equally mature and production-ready.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 9 — unicrypto, asyauth, asysocks, asn1crypto, winacl, prompt-toolkit, tqdm, wcwidth, tabulate |
| Maintenance | aging — 446 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 78,553/month — #14,433 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: msldap-0.5.15-py3-none-any.whl
Tags
More Internet packages
Botocore provides low-level, data-driven access…
permissive · top 100 on PyPI
aiobotocoreProvides an async client for AWS services using…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
filelockProvides a platform-independent file locking…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
googleapis-common-protosProvides common Protocol Buffer message…
permissive · top 100 on PyPI
dsinternalsInteract with Windows Active Directory by…
permissive · top 15,000 on PyPI
ldapdomaindumpCollects and exports Active Directory…
permissive · top 15,000 on PyPI
python-active-directoryAn Active Directory client library for Python…
permissive · top 15,000 on PyPI
requests-negotiate-sspiAdds HTTP Negotiate authentication…
permissive · top 15,000 on PyPI
winaclParses and manipulates Windows security…
permissive · top 15,000 on PyPI
python-ldapProvides an object-oriented Python API to…
permissive · top 5,000 on PyPI
ldaptorLdaptor is a pure-Python LDAP client library…
permissive · top 5,000 on PyPI
winkerberosProvides native Kerberos client authentication…
permissive · top 5,000 on PyPI
impacketImpacket provides low-level Python classes for…
permissive · top 15,000 on PyPI
python3-ldapThis package is a redirect to ldap3—a pure…
copyleft · top 15,000 on PyPI