Skip to main content

Create and verify LDAP password and hash

Project description

# pySSHA-slapd
Python hashlib generator born as a script to test OpenLDAP user passwords.
It supports salted:

- md5
- sha1
- sha224
- sha256
- sha384
- sha512

Introduction
------------
pySSHA-slapd is a simple SSHA string encoder e checker that's quite easy to use:
````
python3 ssha.py -p slapdsecret
{SSHA}omu7YHgg6_uqOIN_epZtfJtGo0ruwdSr
````
Usage
````
usage: ssha.py [-h] -p P [-s S] [-salt_size SALT_SIZE] [-c C] [-enc ENC] [-b]
[-prefixed] [-d D]

Usage: python ssha.py -p Password[-c SSHA hash to check]

optional arguments:
-h, --help show this help message and exit
-p P Password to encode
-s S Salt, 4 bytes in hex format, example "fooo": -s
666f6f6f
-salt_size SALT_SIZE salt lenght
-c C {SSHA} hash to check
-enc ENC Encoder to use, example: sha1 sha224 sha256 sha384
sha512
-b if {SSHA} hash is in base64 format
-prefixed if suffixed or prefixed salt
-d D Debug level from 1 to 5

````

Dependencies
------------
Python3 and hashlib

Usage examples
--------------

You can adopt a specified salt for hashing, in hex format:
````
python3 ssha.py -p slapdsecret -s 74be2629
{SSHA}w5CJCwNQk44NjTYzcMZNKbE6Bu90viYp
````

Verify if a password is valid comparing it with a SSHA hash:
````
python3 ssha.py -c {SHA1}w5CJCwNQk44NjTYzcMZNKbE6Bu90viYp -p slapdsecret
````

Same as previous but ssha hash is in base64 format (like ldapsearch output):
````
python3 ssha.py -c e1NIQTF9dzVDSkN3TlFrNDROalRZemNNWk5LYkU2QnU5MHZpWXA= -b -p slapdsecret
````

Same as the previous but with maximum debug level
````
python3 ssha.py -c e1NIQTF9dzVDSkN3TlFrNDROalRZemNNWk5LYkU2QnU5MHZpWXA= -b -p slapdsecret -d 3

[sshaSplit debug]
ssha_password: {SSHA}w5CJCwNQk44NjTYzcMZNKbE6Bu90viYp
salt: 74be2629
payload: 0b0350938e0d8d363370c64d29b13a06ef

[checkPassword debug]
ssha_password: {SSHA}w5CJCwNQk44NjTYzcMZNKbE6Bu90viYp
created_password: {SSHA}w5CJCwNQk44NjTYzcMZNKbE6Bu90viYp
salt: 74be2629
password: slapdsecret

{SSHA} Check is valid: True
````

select your preferred encoder
````
python3 ssha.py -p slapdsecret -s 74be2629 -enc sha512
{SHA512}4gm2Ep0Nklb8pkss9zIs+t6/BGaGn2QYphl3UeAYuBBNW/hj8glu4jUb7JPb4LVWdCv+g0WoyYUB9VWVajQpjHS+Jik=
````

without salt
````
python3 ssha.py -p ciao -d 3 -salt_size 0 -enc sha512
````

Resources
---------
- https://tools.ietf.org/html/rfc3174
- https://github.com/openldap/openldap/blob/master/libraries/liblutil/sha1.c
- https://github.com/openldap/openldap/blob/master/contrib/slapd-modules/passwd/sha2/README


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

pySSHA-0.6.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

pySSHA-0.6-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file pySSHA-0.6.tar.gz.

File metadata

  • Download URL: pySSHA-0.6.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.5.2

File hashes

Hashes for pySSHA-0.6.tar.gz
Algorithm Hash digest
SHA256 450230d3874fe815ede674995e041fe90c2db7295aaa0183d7fca6f0c0003cc0
MD5 34b411b078777794640e305b29fd26b9
BLAKE2b-256 5978c4a32ca036109db745e7a7108d4d0621fe812cbb69c14f0dbfe83d54b3c6

See more details on using hashes here.

File details

Details for the file pySSHA-0.6-py3-none-any.whl.

File metadata

  • Download URL: pySSHA-0.6-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.5.2

File hashes

Hashes for pySSHA-0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 95cc0c66d7145f97ca955157f4402baa4351dbc52b4f4bbe8273113578cf3f8c
MD5 78c0a3c4cb47e43272c47d9a72a2ae79
BLAKE2b-256 9457931560b74d77ee93b29b437193b553d6127a7b58ec362adede0e23781750

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