Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Secure Password Generator (PyQt6)

A robust and secure desktop application built with Python and PyQt6 for generating cryptographically strong passwords. This project demonstrates clean code principles, professional error handling via decorators, and a Test-Driven Development (TDD) approach.

🚀 Features

Security First

  • Cryptographically Secure: Uses Python's secrets module instead of random, ensuring passwords are suitable for real-world security needs
  • No Data Logging: Generated passwords exist only in memory and clipboard

User Experience

  • Highly Customizable:

    • Adjustable length (8 to 32 characters) via responsive slider
    • Toggleable character sets: Special characters, Numbers, Lowercase, and Uppercase letters
    • Real-time password strength indication
  • Professional Error Handling: Custom Python decorators intercept backend exceptions (ValueErrors, TypeErrors) and display user-friendly GUI alerts

  • Smart Validation: The "Generate" button dynamically disables if no character types are selected, preventing invalid states

  • Clipboard Integration: One-click copying with visual feedback using pyperclip

Developer-Friendly

  • Clean architecture with separation of concerns (Core logic, UI, Tests)
  • Comprehensive unit test coverage
  • Easily extensible for additional features

🛠 Tech Stack

Component Technology
Core Python 3.12+
GUI Framework PyQt6
Testing unittest
Build Tool PyInstaller
Clipboard pyperclip

📂 Project Structure

password_gen_UI/
├── generator.py          # Core logic: Secure password generation and validation
├── main.py               # UI Layer: PyQt6 window, signals/slots, and error decorators
├── test_generator.py     # QA Layer: Comprehensive unit tests
├── requirements.txt      # Project dependencies
├── README.md             # This file
└── output/               # Generated executable output directory

File Descriptions

  • generator.py: Core password generation engine with type validation and security checks
  • main.py: PyQt6 GUI implementation with error handling decorators and clipboard integration
  • test_generator.py: Unit tests covering edge cases and security requirements

🔧 Installation & Setup

Prerequisites

  • Python 3.12 or higher
  • pip package manager
  • Windows/Linux/macOS

Step-by-Step Installation

  1. Clone the repository:

    git clone https://github.com/W1ckeddamn/Secure-Password-Generator.git
    cd secure-pass-gen
  2. Create a virtual environment:

    python -m venv .venv
  3. Activate the virtual environment:

    Windows:

    .venv\Scripts\activate

    Linux/macOS:

    source .venv/bin/activate
  4. Install dependencies:

    pip install -r requirements.txt
  5. Run the application:

    python main.py

📖 Usage Guide

  1. Launch the application using python main.py
  2. Set Password Length: Use the slider to select desired length (8-32 characters)
  3. Select Character Types: Check/uncheck boxes for:
    • Uppercase letters (A-Z)
    • Lowercase letters (a-z)
    • Numbers (0-9)
    • Special characters (!@#$%^&*...)
  4. Generate Password: Click the "Generate" button
  5. Copy to Clipboard: Click the copy button to copy the generated password

Tips

  • Minimum 8 characters recommended for security
  • At least one character type must be selected
  • The "Generate" button disables if no types are selected

## 🧪 Quality Assurance

Run the comprehensive unit tests to ensure stability:

python -m unittest test_generator.py -v

Test Coverage

  • ✅ Type checking (strict integer validation)
  • ✅ Empty alphabet prevention
  • ✅ Character set verification
  • ✅ Password length validation
  • ✅ Randomness and distribution testing

📦 Distribution & Building

Create a Standalone Executable (Windows)

Build a standalone Windows executable using PyInstaller:

pyinstaller --noconfirm --onefile --windowed --name "SecurePassGen" main.py

The executable will be created in the dist/ directory and can be distributed without requiring Python installation.

Build Parameters

  • --onefile: Creates a single executable file
  • --windowed: Removes console window (GUI only)
  • --noconfirm: Overwrites output without asking

🔒 Security Considerations

  • No Telemetry: This application does not collect or send any data
  • Cryptographically Secure: Uses secrets module, which is cryptographically strong
  • Open Source: Full source code available for security audits
  • Local Processing: All operations happen locally on your machine

🐛 Troubleshooting

Issue Solution
"PyQt6 not found" Run pip install -r requirements.txt
Application won't start Ensure Python 3.12+ is installed
Copy button not working Check that pyperclip is installed
Virtual environment not found Recreate with python -m venv .venv

💡 Future Enhancements

  • Password strength indicator
  • Password history
  • Custom character set creation
  • Dark mode theme
  • Batch password generation
  • Password export to CSV

🤝 Contributing

Contributions are welcome! Please feel free to:

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

📄 License

This project is open source and available under the MIT License. See LICENSE file for details.

👨‍💻 Author

Created with ❤️ for secure password generation.

About

Secure password generator built with Python and PyQt6. Features include cryptographically strong generation, UI error handling with decorators, and unit testing.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages