Skip to content

KeyForge is a secure password generator focusing on high entropy, customizable policies, and developer-friendly usage.

License

Notifications You must be signed in to change notification settings

offsec-toolkit/keyforge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

KeyForge πŸ”

Python License: MIT Version

Modern, secure, and feature-rich password and passphrase generator with CLI and Web interfaces.

✨ Features

πŸ”’ Security

  • Cryptographically secure random generation using Python's secrets module
  • Guaranteed character type inclusion (no weak passwords)
  • Entropy calculation and password strength analysis
  • Common password detection

🎯 Password Generation

  • Customizable length (6-128 characters)
  • Character type selection (uppercase, lowercase, digits, special)
  • Custom character sets
  • Multiple password generation
  • PIN codes and hex keys

πŸ“ Passphrase Generation

  • Memorable word-based passphrases
  • Customizable word count and separators
  • EFF wordlist support
  • Optional number inclusion

πŸ’» CLI Features

  • Beautiful colored terminal output
  • Password strength visualization
  • Copy to clipboard
  • QR code generation
  • Export to JSON/CSV/TXT
  • Configuration file support
  • Password templates (web, wifi, pin, etc.)

🌐 Web Interface

  • Modern, responsive design
  • Dark mode support
  • Real-time password generation
  • Strength meter with visual feedback
  • RESTful API

πŸ“¦ Installation

Basic Installation

git clone https://github.com/ismailtsdln/KeyForge.git
cd KeyForge
pip install -e .

Full Installation (Recommended)

# Install with all features (CLI + Web)
pip install -e .[all]

# Or install specific features
pip install -e .[cli]   # CLI features only
pip install -e .[web]   # Web interface only

Development Installation

pip install -e .[dev]

πŸš€ Usage

Command Line Interface

Basic Usage

# Generate a 16-character password (default)
rpg

# Generate password with specific length
rpg --length 20

# Generate multiple passwords
rpg --count 5

# Generate without special characters
rpg --no-special

Passphrase Generation

# Generate a 4-word passphrase
rpg --passphrase

# Generate 6-word passphrase
rpg --passphrase --words 6

# Custom separator
rpg --passphrase --separator "_"

# Add number to passphrase
rpg --passphrase --add-number

Utility Features

# Copy to clipboard
rpg --copy

# Generate QR code
rpg --qrcode

# Export to file
rpg --output passwords.json
rpg --output passwords.csv
rpg --output passwords.txt

# Show password strength
rpg --strength

Templates

# Use predefined templates
rpg --template wifi      # 24 chars, no special
rpg --template pin       # 6-digit PIN
rpg --template maximum   # 32 chars, max security

# List available templates
rpg --list-templates

Special Modes

# Generate PIN code
rpg --pin 6

# Generate hex key (for API tokens)
rpg --hex 32

Configuration

# Create example config
rpg --create-config

# Use custom config
rpg --config my-config.yaml

Web Interface

Start the web server:

python web/app.py

Then open your browser to: http://localhost:5000

Features

  • πŸŒ“ Dark/Light mode toggle
  • πŸ”„ Real-time password generation
  • πŸ“Š Password strength visualization
  • πŸ“‹ One-click copy to clipboard
  • πŸ“± Fully responsive design

Python API

from source import rpg

# Generate password
password = rpg.generate_password(length=16)

# Generate passphrase
passphrase = rpg.generate_passphrase(word_count=4)

# Generate multiple unique passwords
passwords = rpg.generate_multiple_passwords(count=5, length=20)

# Special functions
pin = rpg.generate_pin(length=6)
hex_key = rpg.generate_hex_key(length=32)

# Password strength analysis
from source.strength import analyze_password_strength
analysis = analyze_password_strength(password)
print(f"Strength: {analysis['strength']}")
print(f"Score: {analysis['score']}/100")
print(f"Entropy: {analysis['entropy']} bits")

REST API

The web application exposes RESTful API endpoints:

Generate Password

curl -X POST http://localhost:5000/api/generate \
  -H "Content-Type: application/json" \
  -d '{
    "length": 16,
    "count": 1,
    "use_uppercase": true,
    "use_lowercase": true,
    "use_digits": true,
    "use_special": true
  }'

Generate Passphrase

curl -X POST http://localhost:5000/api/passphrase \
  -H "Content-Type: application/json" \
  -d '{
    "word_count": 4,
    "separator": "-",
    "capitalize": true,
    "include_number": false
  }'

Analyze Password Strength

curl -X POST http://localhost:5000/api/analyze \
  -H "Content-Type: application/json" \
  -d '{"password": "MyP@ssw0rd123"}'

πŸ“‹ Configuration

Create a config.yaml file:

defaults:
  length: 16
  use_uppercase: true
  use_lowercase: true
  use_digits: true
  use_special: true
  passphrase_words: 4

templates:
  web:
    length: 16
    use_special: true
  wifi:
    length: 24
    use_special: false

output:
  show_strength: true
  use_colors: true

πŸ§ͺ Testing

Run tests:

# Run all tests
pytest tests/

# Run with coverage
pytest --cov=source tests/

# Run specific test file
pytest tests/rpg_test.py -v

πŸ“ Project Structure

Python-Random-Password-Generator/
β”œβ”€β”€ source/
β”‚   β”œβ”€β”€ rpg.py          # Core password generation
β”‚   β”œβ”€β”€ cli.py          # Command-line interface
β”‚   β”œβ”€β”€ strength.py     # Password strength analyzer
β”‚   β”œβ”€β”€ utils.py        # Utility functions
β”‚   β”œβ”€β”€ wordlist.py     # EFF wordlist for passphrases
β”‚   └── config.py       # Configuration management
β”œβ”€β”€ web/
β”‚   β”œβ”€β”€ app.py          # Flask application
β”‚   β”œβ”€β”€ templates/
β”‚   β”‚   └── index.html  # Web interface
β”‚   └── static/
β”‚       β”œβ”€β”€ css/
β”‚       β”‚   └── styles.css
β”‚       └── js/
β”‚           └── app.js
β”œβ”€β”€ tests/
β”‚   └── rpg_test.py     # Unit tests
β”œβ”€β”€ run.py              # Legacy runner
β”œβ”€β”€ setup.py            # Package setup
β”œβ”€β”€ requirements.txt    # Dependencies
└── README.md           # This file

πŸ”„ Changelog

Version 2.0.0 (2026-01-01)

  • ✨ New: Cryptographically secure password generation using secrets
  • ✨ New: Modern CLI interface with argparse
  • ✨ New: Passphrase generation with EFF wordlist
  • ✨ New: Password strength analyzer
  • ✨ New: QR code generation
  • ✨ New: Clipboard support
  • ✨ New: File export (JSON/CSV/TXT)
  • ✨ New: Configuration file support
  • ✨ New: Password templates
  • ✨ New: Web interface with Flask
  • ✨ New: RESTful API
  • ✨ New: Dark mode support
  • πŸ› Fixed: Password length bug (was generating random length 8-20)
  • πŸ”’ Security: Replaced random with secrets module
  • βœ… Tests: Comprehensive test suite
  • πŸ“š Docs: Complete documentation with examples

Version 0.1 (Original)

  • Basic password generation

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

πŸ“ License

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

πŸ‘€ Author

İsmail Taşdelen

πŸ™ Acknowledgments

  • EFF Wordlist for memorable passphrases
  • Python secrets module for cryptographically secure random generation
  • All contributors and users of this project

⚠️ Security Notice

This tool generates passwords using Python's secrets module, which is designed for generating cryptographically strong random numbers suitable for managing secrets such as passwords. However, the security of generated passwords also depends on:

  • Using sufficient password length (16+ characters recommended)
  • Enabling multiple character types
  • Not sharing passwords
  • Using unique passwords for each service
  • Storing passwords securely (password manager)

Made with ❀️ by İsmail Taşdelen

About

KeyForge is a secure password generator focusing on high entropy, customizable policies, and developer-friendly usage.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •