A secure password generator in Python with support for alphanumeric passwords and memorable passphrases.
- Alphanumeric passwords: Generate passwords with customizable length
- Passphrases: Create memorable phrases using random words
- Ambiguous character exclusion: Option to avoid confusing characters like 0, O, l, I
- Symbol inclusion: Add special characters for enhanced security
- Command-line interface: Easy to use with customizable arguments
- Python 3.6+
requestslibrary
pip install requestsgit clone git@github.com:Feldt/password-generator.git
cd password-generatoror
git clone https://github.com/feldt/password-generator.git
cd password-generatorpython password_gen.py [options]| Argument | Short form | Type | Default | Description |
|---|---|---|---|---|
--length |
-l |
int | 10 | Password length |
--passphrase |
-p |
flag | False | Generate passphrase instead of password |
--include-symbols |
-i |
flag | False | Include special symbols |
--no-ambiguous |
-s |
flag | False | Exclude ambiguous characters |
--words |
-w |
int | 5 | Number of words in passphrase |
python password_gen.py
# Output: K7mN9qR2Axpython password_gen.py --length 16 --include-symbols
# Output: 8K#mN9@qR2$xP5&wpython password_gen.py --length 12 --no-ambiguous
# Output: 8KmN9qR2xP5wpython password_gen.py --passphrase --words 5
# Output: mountain-whisper-digital-elephant-sunrisepython password_gen.py -p -w 3
# Output: ocean-keyboard-adventure- Purpose: Generates random alphanumeric passwords
- Parameters:
length: Desired password lengthinclude_symbols: Include special charactersno_ambiguous: Exclude ambiguous characters (0, O, l, I)
- Returns: String with generated password
- Purpose: Generates passphrases using random words
- Word source: MIT wordlist (10,000 common words)
- Parameters:
passphrase: Boolean to activate phrase modewords: Number of words to include
- Returns: String with hyphen-separated words
flowchart TD
A[Start] --> B[Parse arguments]
B --> C{Passphrase mode?}
C -->|Yes| D[Download MIT wordlist]
D --> E[Generate random phrase]
E --> F[Display result]
C -->|No| G[Configure character set]
G --> H{Include symbols?}
H -->|Yes| I[Add special symbols]
H -->|No| J[Letters and numbers only]
I --> K{Exclude ambiguous?}
J --> K
K -->|Yes| L[Filter ambiguous characters]
K -->|No| M[Use all characters]
L --> N[Generate random password]
M --> N
N --> F
F --> O[End]
The script distinguishes between visually confusing characters:
- Excluded:
0(zero),O(uppercase O),l(lowercase L),I(uppercase i) - Included: Clearly distinguishable characters
- Uses MIT's wordlist with 10,000 common English words
- Real-time download to ensure variety
- Words connected with hyphens for improved readability
- Local cache: Save wordlist locally for offline use
- Multiple languages: Support for Spanish and other language wordlists
- Strength analysis: Calculate and display password entropy
- Save history: Option to save generated passwords to file
- Graphical interface: Create GUI with tkinter or similar
- Custom configuration: Configuration file for default values
-
Python Standard Library:
random: Random number generationstring: Character constantsargparse: CLI argument parsing
-
External libraries:
requests: Download wordlist from MIT
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -am 'Add new feature') - Push to the branch (
git push origin feature/new-feature) - Create a Pull Request
This project is licensed under the MIT License. See the LICENSE file for details.