This is a Python module to validate the credentials of a Linux user using the /etc/shadow file.
Please take a look at the full documentation for how to install and use shadow_auth:
- GitHub page: https://github.com/ospinakamilo/linux-shadow-auth/
How to use Linux Shadow Authentication:
import shadow_auth
if shadow_auth.validate_with_password("username", "1234"):
# What to do if the user is valid
pass
if shadow_auth.validate_with_hash("username", "$1$TrOIigLp$FJg1nUqEQPt4OerLOWzr/1"):
# What to do if the user is valid
pass
#Get the algorithm and Salt for a User
password_info = shadow_auth.get_password_info("username")
# password_info = {
# "algorithm" = "1",
# "salt" = "TrOIigLp"
# }
#Generate an MD5 hash
new_md5_hash = shadow_auth.generate_openssl_hash(
algorithm=shadow_auth.Algorithm.MD5,
salt="TrOIigLp",
text="abcd12345",
)
# new_md5_hash = "$1$TrOIigLp$FJg1nUqEQPt4OerLOWzr/1"
#Generate an SHA-256 hash
new_sha_256_hash = shadow_auth.generate_openssl_hash(
algorithm=shadow_auth.Algorithm.MD5,
salt="TrOIigLp",
text="abcd12345",
)
# new_sha_256_hash = "$5$TrOIigLp$6usEDvu0NgyuQ/IqQyvSBoP0x2RiNOz5izrMViHwXv2"
#Generate an SHA-512 hash
new_sha_512_hash = shadow_auth.generate_openssl_hash(
algorithm=shadow_auth.Algorithm.MD5,
salt="TrOIigLp",
text="abcd12345",
)
# new_sha_512_hash = "$6$TrOIigLp$IU0KwZfzVkuLLy/9vMFH1RgOmqE3LAGk0K9/15WOGStkeaN2IWYkY0jzCWHMUcSnnewnt9bOUwD2vStgko79v/"
Release files for shadow-auth 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| shadow_auth-0.1.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shadow_auth-0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.1 kB
Release files / shadow_auth-0.1.tar.gz
| Download URL | shadow_auth-0.1.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f847ecf7e92af5028fe49cf29edad424c2c1304bce4b2ffd351f8b38c2933d68
|
|
BLAKE2b-256 checksum How to use checksums |
77da7b96d9cfbd6146434f784215a974dfab0f829212d0441e2ba2ab25502284
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|
Release files / shadow_auth-0.1-py3-none-any.whl
| Download URL | shadow_auth-0.1-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e7702c08af30df82a06037610ec3855a706b0e0a53514d77d0b12365851f22d3
|
|
BLAKE2b-256 checksum How to use checksums |
c3bb46977e15096abc7f1ee9f8dd8c9724f2aaee682784c3edf4ccff3a92fa0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|