README
ΒΆ
passgen
A secure, customizable password generator CLI tool written in Go.
Features
- Secure Random Generation: Uses cryptographically secure random number generation
- Customizable Character Sets: Choose from lowercase, uppercase, numbers, and symbols
- Advanced Options: Exclude similar characters, custom character exclusion
- Multiple Passwords: Generate multiple passwords at once
- Password Strength Checker: Analyze password strength and get improvement suggestions
- Preset Configurations: Quick presets for common use cases
- Cross-Platform: Works on Linux, macOS, and Windows
Installation
Method 1: Automated Installation (Recommended)
The easiest way to install passgen with automatic PATH configuration:
# Download and run the installation script
curl -sSL https://raw.githubusercontent.com/kumarasakti/passgen/main/install.sh | bash
# Or clone and run locally
git clone https://github.com/kumarasakti/passgen.git
cd passgen
./install.sh
This script will:
- Install passgen using
go install - Automatically detect your shell (zsh, bash, fish)
- Add Go's bin directory to your PATH
- Make passgen immediately available
Note: For PowerShell users, see Method 3: PowerShell Installation for a native PowerShell experience.
Method 2: Quick One-liner
curl -sSL https://raw.githubusercontent.com/kumarasakti/passgen/main/quick-install.sh | bash
Method 3: PowerShell Installation (Windows/Linux/macOS)
For PowerShell users on any platform:
# Automated installation with interactive prompts
irm https://raw.githubusercontent.com/kumarasakti/passgen/main/install.ps1 | iex
# Quick installation without prompts
irm https://raw.githubusercontent.com/kumarasakti/passgen/main/quick-install.ps1 | iex
# Or run locally
git clone https://github.com/kumarasakti/passgen.git
cd passgen
.\install.ps1
This PowerShell script will:
- Install passgen using
go install - Automatically configure your PowerShell profile
- Add Go's bin directory to your PATH
- Work on Windows PowerShell, PowerShell Core, and Linux/macOS
For Linux/macOS with PowerShell:
curl -sSL https://raw.githubusercontent.com/kumarasakti/passgen/main/install.ps1 | pwsh
Method 4: Manual Go Install
go install github.com/kumarasakti/passgen@latest
Important: After manual installation, you need to add Go's bin directory to your PATH:
# For zsh users
echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.zshrc
source ~/.zshrc
# For bash users
echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc
source ~/.bashrc
For PowerShell users:
# Add to your PowerShell profile
$env:PATH += ";$(go env GOPATH)\bin" # Windows
$env:PATH += ":$(go env GOPATH)/bin" # Linux/macOS
Method 5: Download Pre-built Binaries
Download the latest release for your platform from the releases page and place it in your PATH.
Method 6: Build from Source
git clone https://github.com/kumarasakti/passgen.git
cd passgen
make build
sudo mv build/passgen /usr/local/bin/ # Install to system PATH
Verify Installation
passgen --version
passgen --help
If you get "command not found", your Go bin directory is not in PATH. Use Method 1 (automated installation) or follow the PATH setup instructions in Method 3.
Usage
Basic Usage
# Generate a default password (12 characters, letters and numbers)
passgen
# Generate a 16-character password with symbols
passgen -l 16 -s
# Generate 5 passwords at once
passgen -c 5
# Generate a secure password (all character types)
passgen --secure
Advanced Options
# Exclude similar characters (i, l, 1, L, o, 0, O)
passgen --exclude-similar
# Exclude specific characters
passgen --exclude "aeiou"
# Generate only numbers (PIN)
passgen --lower=false --upper=false --numbers=true --symbols=false -l 6
# Generate alphanumeric password
passgen --alphanumeric -l 12
Preset Configurations
# Secure password (16 chars, all types)
passgen preset secure
# Simple password (12 chars, letters and numbers)
passgen preset simple
# PIN (6 digits)
passgen preset pin
# Alphanumeric (12 chars, letters and numbers)
passgen preset alphanumeric
Password Strength Checker
# Check password strength
passgen check "mypassword123"
# Example output:
# Strength: Medium (Score: 4/8)
# Suggestions: Add uppercase letters, Add special characters
Command Line Options
| Flag | Short | Description | Default |
|---|---|---|---|
--length |
-l |
Password length | 12 |
--count |
-c |
Number of passwords to generate | 1 |
--lower |
Include lowercase letters | true | |
--upper |
Include uppercase letters | true | |
--numbers |
-n |
Include numbers | true |
--symbols |
-s |
Include symbols | false |
--exclude-similar |
Exclude similar characters (il1Lo0O) | false | |
--exclude |
Characters to exclude | "" | |
--secure |
-S |
Generate secure password (all types) | false |
--simple |
-m |
Generate simple password (letters + numbers) | false |
--alphanumeric |
-a |
Generate alphanumeric password | false |
--help |
-h |
Show help message | |
--version |
-v |
Show version |
Examples
Generate Different Types of Passwords
# Default password (14 characters, uppercase, lowercase, symbols)
$ passgen
π Password Generated Successfully! π
Password: -PUZ:@)x$DSloj
π Password Analysis:
β
Length: 14 characters (Good!)
β
Character Sets: Lowercase, Uppercase, Symbols
β
Entropy: 88.0 bits (Very Strong!)
β
Strength: Very Strong πͺ
π Security Assessment:
β’ This password would take approximately 4892016 years to crack with modern hardware
β’ Contains 3 different character types for excellent complexity
β’ Exceeds security standards for high-value accounts
Someone's taking this security thing seriously! π
# Secure password with all character types (gets the ice cold message!)
$ passgen --secure -l 20
π Password Generated Successfully! π
Password: =;1.7y$A]RqH8a7):s&C
π Password Analysis:
β
Length: 20 characters (Excellent!)
β
Character Sets: Lowercase, Uppercase, Numbers, Symbols
β
Entropy: 129.2 bits (Extremely Strong!)
β
Strength: Extremely Strong π₯
π Security Assessment:
β’ This password would take approximately 1.2e+19 years to crack with modern hardware
β’ Contains 4 different character types for maximum complexity
β’ Quantum-resistant for the foreseeable future!
Brr, that's ice cold security! Even hackers are shivering! π₯Ά
# Medium strength password (with sarcastic feedback)
$ passgen -l 8
β¨ Password Generated! β¨
Password: gz*yK#<&
π Password Analysis:
β οΈ Length: 8 characters (Could be longer)
β
Character Sets: Lowercase, Uppercase, Symbols
β
Entropy: 50.3 bits (Medium!)
β
Strength: Medium β‘
π Security Assessment:
β’ This password would take approximately 11.4 minutes to crack with modern hardware
β’ Contains 3 different character types for excellent complexity
β’ Adequate for most general purposes
π‘ Tips for improvement:
β’ Consider using 12+ characters for better security
Well, it's... adequate. I guess that's something! π
Advanced Usage
# Generate multiple passwords
$ passgen -c 2 -l 10
π Password Generated Successfully! π
Password: CIMc|OVmzv
π Password Analysis:
β
Length: 10 characters (Good!)
β
Character Sets: Lowercase, Uppercase, Symbols
β
Entropy: 62.9 bits (Strong!)
β
Strength: Strong π―
π Security Assessment:
β’ This password would take approximately 1.2 years to crack with modern hardware
β’ Contains 3 different character types for excellent complexity
β’ Great for securing important accounts
Not bad, you actually read the security guidelines! π―
==================================================
π Password Generated Successfully! π
Password: oXEduV)%|K
π Password Analysis:
β
Length: 10 characters (Good!)
β
Character Sets: Lowercase, Uppercase, Symbols
β
Entropy: 62.9 bits (Strong!)
β
Strength: Strong π―
π Security Assessment:
β’ This password would take approximately 1.2 years to crack with modern hardware
β’ Contains 3 different character types for excellent complexity
β’ Great for securing important accounts
Not bad, you actually read the security guidelines! π―
# Check version
$ passgen --version
passgen version v1.0.3
Development
Installation Scripts
This repository includes multiple installation scripts for different environments:
install.sh- Full-featured bash installer with shell detection (zsh, bash, fish)quick-install.sh- Minimal bash installer for quick setupinstall.ps1- Full-featured PowerShell installer (Windows/Linux/macOS)quick-install.ps1- Minimal PowerShell installer for quick setup
All scripts automatically handle PATH configuration and provide colored output with error handling.
Building
# Install dependencies
make deps
# Build for current platform
make build
# Build for all platforms
make build-all
# Run tests
make test
# Development workflow (format, lint, test, build)
make dev
Testing
# Run all tests
make test
# Run tests with coverage
go test -cover ./...
# Run specific test
go test -run TestGeneratePassword
Release
# Create release binaries and archives
make release
Security
This tool uses Go's crypto/rand package for cryptographically secure random number generation. The generated passwords are suitable for production use.
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
v1.0.0
- Initial release
- Basic password generation with customizable options
- Password strength checker
- Preset configurations
- Cross-platform support
Documentation
ΒΆ
There is no documentation for this package.