Skip to main content

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.

Features

This program offers the following features:

  • Support for both anonymous and authenticated LDAP queries.
  • Encrypted queries with SSL.
  • Support for LDAP filters and LDAP paging (retrieve the total amount of entries, regardless of limitations imposed by the server)!.
  • Export results to CSV.

Requirements

Make sure you meet the following requirements:

Installation

You can install it with pip:

pip install ldap-attributes-selector

Usage

First, some aspects of this tool to take into account:

  • Results are shown in CSV format, but they aren't written to a file by default!.
  • Note that whenever an LDAP entry doesn't have any of the provided attributes, a None value is set, instead!.
  • When establishing an SSL connection, depending on the security settings on 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!.

Here's the complete 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"

License

This program is licensed under the GPLv3.

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

ldap-attributes-selector-0.2.7.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

ldap_attributes_selector-0.2.7-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file ldap-attributes-selector-0.2.7.tar.gz.

File metadata

  • Download URL: ldap-attributes-selector-0.2.7.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3

File hashes

Hashes for ldap-attributes-selector-0.2.7.tar.gz
Algorithm Hash digest
SHA256 280b2c01a0c69827514f4fc1c107de0434c931c48ab21f3c0ebfed715656cb25
MD5 ccd190ee30e274f9ac809f936385f3bc
BLAKE2b-256 b0966ef3653533f5e54f9f08ed8a71cde571aaa55f48cfaa3f1b1e7358da7367

See more details on using hashes here.

File details

Details for the file ldap_attributes_selector-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: ldap_attributes_selector-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3

File hashes

Hashes for ldap_attributes_selector-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 d70bdd7975d0cbeef4ced0d46823c55a5a8cdee9e79253136b22d05da5065b3c
MD5 5445ef9ce0bd43b1b0e1265c4850e1c8
BLAKE2b-256 c29ea939279adbade2616a3f7a3a58bade66ac9bb0cec60cc1541dd793c21aa6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page