Skip to content

Latest commit

 

History

History
217 lines (157 loc) · 6.32 KB

File metadata and controls

217 lines (157 loc) · 6.32 KB

🔐 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.