| name | password-generator |
| description | Generate secure passwords and passphrases with customizable rules. Check password strength, generate bulk passwords, and create memorable passphrases. |
Password Generator
Generate cryptographically secure passwords and memorable passphrases. Customize character sets, length, and rules. Includes strength checking and bulk generation.
Quick Start
from scripts.password_gen import PasswordGenerator
gen = PasswordGenerator()
password = gen.generate(length=16)
print(password)
passphrase = gen.passphrase(words=4)
print(passphrase)
Features
- Secure Generation: Uses cryptographically secure random
- Custom Rules: Character sets, required types, exclusions
- Passphrases: Word-based memorable passwords
- Strength Check: Evaluate password strength
- Bulk Generation: Generate multiple passwords
- Pronounceable: Generate easier-to-type passwords
API Reference
Basic Generation
gen = PasswordGenerator()
password = gen.generate()
password = gen.generate(length=24)
Character Options
password = gen.generate(
length=16,
uppercase=True,
lowercase=True,
digits=True,
symbols=True
)
password = gen.generate(length=16, exclude_ambiguous=True)
password = gen.generate(length=16, charset="abc123!@#")
password = gen.generate(length=16, exclude="{}[]")
Requirements
password = gen.generate(
length=16,
min_uppercase=2,
min_lowercase=2,
min_digits=2,
min_symbols=2
)
Passphrases
passphrase = gen.passphrase(words=4)
passphrase = gen.passphrase(words=4, separator="_")
passphrase = gen.passphrase(words=3, include_number=True)
passphrase = gen.passphrase(words=4, capitalize=True)
Strength Check
strength = gen.check_strength("MyP@ssw0rd!")
Bulk Generation
passwords = gen.generate_bulk(count=10, length=16)
gen.generate_to_csv("passwords.csv", count=100, length=20)
CLI Usage
python password_gen.py --length 16
python password_gen.py --passphrase --words 4
python password_gen.py --length 20 --no-symbols --exclude-ambiguous
python password_gen.py --count 10 --length 16
python password_gen.py --check "MyPassword123!"
python password_gen.py --count 100 --output passwords.txt
CLI Arguments
| Argument | Description | Default |
|---|
--length | Password length | 16 |
--count | Number to generate | 1 |
--passphrase | Generate passphrase | False |
--words | Words in passphrase | 4 |
--no-uppercase | Exclude uppercase | False |
--no-lowercase | Exclude lowercase | False |
--no-digits | Exclude digits | False |
--no-symbols | Exclude symbols | False |
--exclude-ambiguous | Exclude 0, O, l, 1 | False |
--check | Check password strength | - |
--output | Output file | - |
Examples
Strong Random Password
gen = PasswordGenerator()
password = gen.generate(
length=20,
min_uppercase=2,
min_lowercase=2,
min_digits=2,
min_symbols=2
)
print(f"Password: {password}")
print(f"Strength: {gen.check_strength(password)['label']}")
Memorable Passphrase
gen = PasswordGenerator()
passphrase = gen.passphrase(
words=4,
capitalize=True,
include_number=True,
separator="-"
)
print(passphrase)
PIN Generation
gen = PasswordGenerator()
pin = gen.generate(
length=6,
uppercase=False,
lowercase=False,
digits=True,
symbols=False
)
print(f"PIN: {pin}")
Batch for Team
gen = PasswordGenerator()
team = ["alice", "bob", "charlie"]
for member in team:
password = gen.generate(length=16)
print(f"{member}: {password}")
Strength Scoring
| Score | Label | Description |
|---|
| 0 | Very Weak | < 28 bits entropy |
| 1 | Weak | 28-35 bits |
| 2 | Fair | 36-59 bits |
| 3 | Strong | 60-127 bits |
| 4 | Very Strong | 128+ bits |
Dependencies
(No external dependencies - uses Python standard library)
Security Notes
- Uses
secrets module for cryptographic randomness
- Never logs or stores generated passwords
- Passphrase wordlist is embedded (no external calls)
- Strength check is local (no external API)