Get a CSV formatted list, based on a custom set of LDAP attributes.
Project description
LDAP Attributes Selector
This command line program, allows you to query an LDAP server and retrieve a custom set of provided attributes. The results are given in CSV format, though they are not written to a CSV file unless explicitly specified.
Whenever an LDAP entry doesn't have any of the provided attributes, a None
value is set, instead!.
Requirements
Make sure you meet the following requirements:
- Python 3
- python-ldap library (tested with v3.1.0).
Also, note that when establishing an SSL connection, depending on the security settings in your LDAP server, you might gonna need to perform some additional configuration on your LDAP client!.
As a general rule, if you are able to make an LDAP query with the ldapsearch
tool, this program should work as well!.
Installation
You can install it with pip
:
pip install ldap-attributes-selector
Usage
Help output:
usage: ldap-attributes-selector [-h] [-u USERDN] [-S SIZELIMIT] [-f FILTER]
[-w WRITETOCSV] [-v]
SERVER BASEDN ATTRIBUTES
Get a CSV formatted list, based on a custom set of LDAP attributes
positional arguments:
SERVER URI formatted address (IP or domain name) of the LDAP
server
BASEDN Specify the searchbase or base DN of the LDAP server
ATTRIBUTES A set of comma separated LDAP attributes to list
optional arguments:
-h, --help show this help message and exit
-u USERDN, --userdn USERDN
Distinguished Name (DN) of the user to bind to the
LDAP directory
-S SIZELIMIT, --sizelimit SIZELIMIT
The amount of per-page entries to retrieve (Default:
500)
-f FILTER, --filter FILTER
Specify an LDAP filter (Default: 'objectClass=*')
-w WRITETOCSV, --writetocsv WRITETOCSV
Write results to a CSV file!.
-v, --version Show current version
Examples
In the following example, an encrypted LDAP query (note the ldaps://
when specifying the LDAP server) is made, and the attributes name
, mail
and ipPhone
are retrieved. Also, LDAP filter objectClass=person
is set:
ldap-attributes-selector ldaps://somecorp.com "dc=somecorp,dc=com" -u "cn=Joe,ou=Users,dc=somecorp,dc=com" "name,mail,ipPhone" -f objectClass=person
Unlike the previous example, on the following one, the query isn't encrypted and a different LDAP filter is used:
ldap-attributes-selector ldap://somecorp.com "dc=somecorp,dc=com" -u "uid=zimbra,cn=admins,cn=zimbra" "givenName,mail,zimbraAccountStatus" -f 'objectClass=inetOrgPerson'
This one is similar to the first one except that, this time, the retrieved results, are gonna be exported to a CSV file!:
ldap-attributes-selector ldaps://somecorp.com "dc=somecorp,dc=com" -u "cn=joe,ou=Users,dc=somecorp,dc=com" "name,mail,ipPhone" -f objectClass=person -w users.csv
If no user identity (in DN format!) is specified (-u
argument), an anonymous LDAP query is performed, as in the following example:
ldap-attributes-selector ldap://somecorp.com "dc=somecorp,dc=com" "sn,givenName,mail"
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ldap-attributes-selector-0.2.4.tar.gz
.
File metadata
- Download URL: ldap-attributes-selector-0.2.4.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f01975945b94b65da144a0fe31142816b705504dda45bf458aa2638407cdf5b3 |
|
MD5 | 04aff969abe977d4355c178569f241e2 |
|
BLAKE2b-256 | 281cfcf833862ce1f1b8bcef7cc74d8b66639923702a64773f0949897c210ed5 |
File details
Details for the file ldap_attributes_selector-0.2.4-py3-none-any.whl
.
File metadata
- Download URL: ldap_attributes_selector-0.2.4-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a3132ac8c3de59895d8413b31cb03b9177bc0ab5e6e9857e696ad63ebab8074 |
|
MD5 | 6a99ddb31460b4fd04061d447964deb2 |
|
BLAKE2b-256 | edbb29248aeb1548c91c873f9d828793a5d900afbadb8b5a57ef4d26466f5e2e |