Skip to content

PawanChoudhary0607/Python-Password-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Python CLI Random Password Generator

Python License Status Type

A menu-driven, console-based password generator built entirely with the Python Standard Library. It generates cryptographically secure random passwords from letters and numbers, with full input validation and a continuously running menu until the user chooses to exit.

This project was built as Project 3 for the Python Programming Internship at DecodeLabs, following the official assignment requirements for a Core Python CLI password generator.


πŸ“– Project Description

The application asks the user for a desired password length, validates that input, and generates a random password made up of uppercase letters, lowercase letters, and digits. It runs in a loop, presenting a menu of options, until the user explicitly selects Exit. Nothing is written to disk β€” all settings and generated passwords exist only for the duration of a single run.


✨ Features

# Feature Description
1 Generate Password Creates one random password using the current length setting.
2 Change Password Length Updates the active password length (4–128 characters), with the option to cancel.
3 Generate Multiple Passwords Generates a user-specified batch of passwords (up to 50) in one go.
4 View Current Settings Displays the active password length and character pool details.
5 Reset Settings Restores the password length to the application default (12).
6 Exit Ends the program with a closing message.

Input validation rejects empty input, non-numeric values, zero, and negative numbers for every prompt β€” the program never crashes on bad input.


πŸ› οΈ Tech Stack

  • Language: Python 3
  • Standard Library Modules:
    • secrets β€” cryptographically secure random character selection
    • string β€” predefined character set constants (ascii_letters, digits)
  • No external packages, GUI frameworks, databases, or file storage

πŸ“ Folder Structure

Password_Generator_Project/
β”œβ”€β”€ main.py                 # Complete application source code
β”œβ”€β”€ README.md                # Project documentation (this file)
β”œβ”€β”€ LICENSE                  # MIT License
β”œβ”€β”€ .gitignore                # Python ignore rules
β”œβ”€β”€ PROJECT_STRUCTURE.md      # Explanation of every file
└── screenshots/               # Real terminal screenshots
    β”œβ”€β”€ home.png
    β”œβ”€β”€ generate-password.png
    β”œβ”€β”€ multiple-passwords.png
    β”œβ”€β”€ change-length.png
    β”œβ”€β”€ current-settings.png
    β”œβ”€β”€ reset-settings.png
    β”œβ”€β”€ invalid-input.png
    β”œβ”€β”€ invalid-length.png
    └── exit.png

βš™οΈ Installation

Clone the repository:

git clone https://github.com/PawanChoudhary0607/Python-Password-Generator.git
cd Python-Password-Generator

No additional dependencies need to be installed β€” the project uses only the Python Standard Library.


▢️ How to Run

Requires Python 3.x.

python3 main.py

On Windows:

python main.py

πŸ”„ Program Flow

  1. The application starts and displays a welcome message with the default password length (12).
  2. The main menu is displayed with six options.
  3. The user selects an option by entering a number from 1 to 6.
  4. Invalid input (empty, non-numeric, or out of range) is rejected and the user is re-prompted.
  5. The selected action runs (generate, change length, generate multiple, view settings, or reset).
  6. The menu is displayed again, and the loop continues until the user selects Exit.

πŸ’» Example Output

========================================
      RANDOM PASSWORD GENERATOR
========================================
1. Generate Password
2. Change Password Length
3. Generate Multiple Passwords
4. View Current Settings
5. Reset Settings
6. Exit
========================================
Select an option (1-6): 1

Generated Password: BQWTWjyHrTDz

πŸ“Έ Screenshots

Home Screen

Home Screen

Generate Password

Generate Password

Generate Multiple Passwords

Generate Multiple Passwords

Change Password Length

Change Password Length

View Current Settings

Current Settings

Reset Settings

Reset Settings

Invalid Menu Input Handling

Invalid Input

Invalid Length Input Handling

Invalid Length

Exit

Exit


πŸŽ“ Learning Outcomes

Building this project reinforced:

  • Designing a modular, function-based CLI application with a clear separation between input validation, core logic, and menu handling
  • Writing robust input validation that gracefully handles empty, non-numeric, zero, and negative input without crashing
  • Using secrets.choice() for cryptographically secure random selection instead of the general-purpose random module
  • Structuring a continuously running menu loop with clean exit handling, including KeyboardInterrupt and EOFError
  • Writing PEP8-compliant, well-commented, professional Python code

πŸš€ Future Improvements

These are potential directions for future versions, not features included in the current implementation:

  • Optional inclusion of special characters and uppercase/lowercase toggles
  • Password strength indicator
  • Copy-to-clipboard support
  • Exporting generated passwords to an encrypted local file

πŸ‘€ Author

Pawan Choudhary B.Tech CSE (AI & ML) Python Programming Intern @ DecodeLabs

GitHub: https://github.com/PawanChoudhary0607


πŸ“„ License

This project is licensed under the MIT License.

About

A Python CLI Random Password Generator built using Core Python to generate secure random passwords with input validation and configurable password length.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages