Skip to content

alrdz/password-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Password Generator

A secure password generator in Python with support for alphanumeric passwords and memorable passphrases.

Features

  • 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

Installation

Requirements

  • Python 3.6+
  • requests library
pip install requests

Clone the repository

git clone git@github.com:Feldt/password-generator.git
cd password-generator

or

git clone https://github.com/feldt/password-generator.git
cd password-generator

Usage

Basic syntax

python password_gen.py [options]

Available arguments

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

Usage examples

Basic password (10 characters)

python password_gen.py
# Output: K7mN9qR2Ax

Long password with symbols

python password_gen.py --length 16 --include-symbols
# Output: 8K#mN9@qR2$xP5&w

Password without ambiguous characters

python password_gen.py --length 12 --no-ambiguous
# Output: 8KmN9qR2xP5w

Passphrase (5 words)

python password_gen.py --passphrase --words 5
# Output: mountain-whisper-digital-elephant-sunrise

Custom passphrase

python password_gen.py -p -w 3
# Output: ocean-keyboard-adventure

Code Architecture

Main functions

generate_random_string(length, include_symbols, no_ambiguous)

  • Purpose: Generates random alphanumeric passwords
  • Parameters:
    • length: Desired password length
    • include_symbols: Include special characters
    • no_ambiguous: Exclude ambiguous characters (0, O, l, I)
  • Returns: String with generated password

generate_random_phrase(passphrase, words)

  • Purpose: Generates passphrases using random words
  • Word source: MIT wordlist (10,000 common words)
  • Parameters:
    • passphrase: Boolean to activate phrase mode
    • words: Number of words to include
  • Returns: String with hyphen-separated words

Execution flow

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]
Loading

Implemented improvements

Ambiguous character handling

The script distinguishes between visually confusing characters:

  • Excluded: 0 (zero), O (uppercase O), l (lowercase L), I (uppercase i)
  • Included: Clearly distinguishable characters

External word source

  • Uses MIT's wordlist with 10,000 common English words
  • Real-time download to ensure variety
  • Words connected with hyphens for improved readability

Future improvements

  • 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

Dependencies

  • Python Standard Library:

    • random: Random number generation
    • string: Character constants
    • argparse: CLI argument parsing
  • External libraries:

    • requests: Download wordlist from MIT

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/new-feature)
  3. Commit your changes (git commit -am 'Add new feature')
  4. Push to the branch (git push origin feature/new-feature)
  5. Create a Pull Request

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages