A fast, flexible command-line password generator written in Python.
Uses Python's secrets module for cryptographically secure randomness.
- Cryptographically secure — powered by
secrets.token_bytes - Fully customisable: length, character sets, count
- Strength indicator on every password
- Optional clipboard copy (
--copy) - Zero external dependencies by default
- Full test suite with
pytest
# Clone the repo
git clone https://github.com/YOUR_USERNAME/password-generator.git
cd password-generator
# Run with defaults (16-char password)
python password_generator.pyOutput:
Password: x$K7mN!qR2pL@wYv
Strength: 🟢 Very Strong
python password_generator.py [OPTIONS]
| Option | Description | Default |
|---|---|---|
-l N, --length N |
Password length | 16 |
-n N, --count N |
Number of passwords | 1 |
--no-uppercase |
Exclude A–Z | off |
--no-digits |
Exclude 0–9 | off |
--no-symbols |
Exclude special chars | off |
--copy |
Copy first password to clipboard | off |
# 24-character password
python password_generator.py -l 24
# Generate 5 passwords at once
python password_generator.py -n 5
# Letters + digits only (no symbols)
python password_generator.py --no-symbols
# 32-char password, copied to clipboard
python password_generator.py -l 32 --copypip install pytest
python -m pytest tests/ -v| Package | Purpose | Install |
|---|---|---|
pyperclip |
--copy flag |
pip install pyperclip |
password-generator/
├── password_generator.py # Core logic + CLI
├── tests/
│ └── test_password_generator.py
├── requirements.txt
├── .gitignore
└── README.md
MIT License — free to use, modify, and distribute.