GithubHelp home page GithubHelp logo

sqldap's Introduction

SQLDAP

Ever wanted to query AD or LDAP with SQL like queries ?

I'm going to answer this question myself: yes ! Why ? Because I never could remember all the ldapsearch arguments and filters, etc.

But after building this tool I am now a master of ldapsearch :)

Supported queries:

  • simple select queries: SELECT * FROM "$tablename" WHERE var=val;
  • show databases; show tables;

Work in Progress:

  • update queries: Don't use this in a production environment !!!

Example queries:

@group should be defined in sqldap.ini (see sqldap.ini.example)

Select from default (first) configured server:

[user@awesome ~]$ sqldap 'SELECT memberuid FROM @group WHERE cn=groupname'

Select from a different configured Active Directory server named examplead

[user@awesome ~]$ sqldap 'SELECT gid FROM @group ' examplead

Don't use > and <

> and < are not supported, work your way around this problem by using: >= and <=

This is a valid query:

[user@awesome ~]$ sqldap 'SELECT uid,cn,passwordretrycount,ou FROM @people WHERE passwordretrycount>=3'

This is an invalid query:

[user@awesome ~]$ sqldap 'SELECT uid,cn,passwordretrycount,ou FROM @people WHERE passwordretrycount>2'`

You can also run queries that are defined in the sqldap.ini config file:

[user@awesome ~]$ sqldap @passwordretrycount

When you pass a filename as an argument, then sqldap parses the file and executes the queries that are defined this file

[user@awesome ~]$ sqldap queries.sql

Using config file /home/user/sqldap/sqldap.ini
Using server: exampleldap (ldap://ldap.example.com:389)

+-------+-------------+--------------------+----------+
| uid   | cn          | passwordretrycount | ou       |
+-------+-------------+--------------------+----------+
| user1 | Username1   | 3                  | group1   |
+-------+-------------+--------------------+----------+
| user2 | Username2   | 3                  | group2   |
+-------+-------------+--------------------+----------+
| user3 | Username3   | 3                  | group3   |
+-------+-------------+--------------------+----------+

[user@awesome ~]$

Compiling from source

First you'll have to install Rust on your system:

[user@awesome ~]$ curl https://sh.rustup.rs -sSf | sh

Now run the following command in the root of the project:

[user@awesome ~]$ cargo build --release

The sqldap binary can be found in the target/release/ folder.

sqldap's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.