A Python library for enforcing password policies and compliance
Project description
Password Policy Compliance Library
A Python library that helps enforce password policies, ensuring password compliance with best practices and industry standards.
Features
- Password validation against customizable security policies
- Policy compliance checking
- Compliance reporting and auditing
Installation
To install the Password Policy Compliance Library, run:
pip install password-policy-compliance
Usage
Here's a quick example of how to use the library:
from password_policy_compliance import password_validator, policy_compliance, compliance_reporter
# Create a policy
policy = policy_compliance.Policy(
name="Custom Policy",
min_length=8,
require_uppercase=True,
require_lowercase=True,
require_digits=True,
require_special=True
)
# Validate a password
password = "MyP@ssw0rd"
result = password_validator.validate_password(password, policy)
if result["valid"]:
print(f"Password '{password}' is valid!")
else:
print(f"Password '{password}' is invalid. Errors:")
for error in result["errors"]:
print(f"- {error}")
# Generate a compliance report
passwords = ["StrongP@ss1", "weakpass", "NoSpecial1", "sh0rt", "AllLowercase123!"]
report = compliance_reporter.generate_compliance_report(passwords, policy)
print(f"\nCompliance report:")
print(f"Total passwords: {report['total_passwords']}")
print(f"Compliant passwords: {report['compliant_passwords']}")
print(f"Non-compliant passwords: {report['non_compliant_passwords']}")
print(f"Compliance rate: {report['compliance_rate']}%")
# Audit password compliance
print("\nPassword audit:")
audit_results = compliance_reporter.audit_password_compliance(passwords, policy)
for result in audit_results:
print(f"Password: {result['password']}, Compliant: {result['compliant']}")
if not result['compliant']:
print(f"Errors: {', '.join(result['errors'])}")
For more detailed examples, check the examples
directory in the repository.
Documentation
For more detailed documentation, please refer to the docstrings in the source code. Full documentation will be available soon.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Author
Bassem Abidi (abidi.bassem@me.com)
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file password_policy_compliance-0.1.3.tar.gz
.
File metadata
- Download URL: password_policy_compliance-0.1.3.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7de7b107cb6bf4551db7d022cc0c7f7947a04b087a013ab69833b71b75aba215 |
|
MD5 | 8819738ef0eee55307153818e541368d |
|
BLAKE2b-256 | b48fef411f44f4419d1f223fb6549c1283d76e8a94950b8374bde6ac506d0a5c |
File details
Details for the file password_policy_compliance-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: password_policy_compliance-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c44af2b2c0a154cfdcce9baf858285dbbfc7a282cdc18fff177af66675b326f1 |
|
MD5 | 9c79aa7456adaa402e0576fd213c27c7 |
|
BLAKE2b-256 | 751775d530c3685806de4f2e70dac59b53e9625cc101e6927ef312bdd4ee8f31 |