Giter Club home page Giter Club logo

ldifparse's Introduction

ldifparse

Parse LDIF data into common text formats. It currently supports conversion to JSON and to YAML.

This is a thin wrapper around the python-ldap package.

From:

$ ldapsearch -Q -L -Y EXTERNAL -H ldapi:/// -b dc=company,dc=com
version: 1

#
# LDAPv3
# base <dc=company,dc=com> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# company.com
dn: dc=company,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
o: company
dc: company

# admin, company.com
dn: cn=admin,dc=company,dc=com
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator

# search result

# numResponses: 3
# numEntries: 2

To :

$ ldapsearch -Q -L -Y EXTERNAL -H ldapi:/// -b dc=company,dc=com | ldifparse
cn=admin,dc=company,dc=com:
  cn: admin
  description: LDAP administrator
  objectClass:
  - simpleSecurityObject
  - organizationalRole
dc=company,dc=com:
  dc: company
  o: company
  objectClass:
  - top
  - dcObject
  - organization

Installation

with pip/pipx

The recommended way of installing ldifparse is through the pipx installer :

pipx install ldifparse

ldifparse will be installed in an isolated environment but will be available globally as a shell application.

Alternatively, you can install ldifparse in an environment of your choosing with pip :

pip install ldifparse

manually

You can also download the source code from github :

git clone https://github.com/MatteoBouvier/ldifparse.git

Tips

We recommend also installing jq for viewing and manipulating JSON in the terminal. The YAML equivalent is yq.

Usage

The simplest way to use ldifparse is by piping it some LDIF data :

cat input.ldif | ldifparse

This will print a YAML version of the data to stdout.

Output format

You can specify the ouput format with the --output parameter (-o for the short version). The output can either be json or yaml (-oj and -oy are also accepted as shorthands).

Tree structure

Instead of a perfect translation of LDIF to JSON/YAML, you can get a tree representation with the --tree (-t) parameter.

ldifparse's People

Contributors

matteobouvier avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.