Skip to content

hakmarkdev/passgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PassGen

A secure, cryptographically-random password generator CLI tool. assGen generates strong passwords with customizable character sets and includes clipboard support with automatic clearing for enhanced security.

Overview

PassGen is a command-line password generator that prioritizes security and flexibility. Key features include:

  • Cryptographically secure random generation using crypto/rand
  • Configurable character sets (lowercase, uppercase, digits, symbols)
  • Character type guarantee - ensures at least one character from each enabled type
  • Secure clipboard integration with automatic timeout clearing
  • Comprehensive validation with length limits (4-256 characters)
  • Detailed logging with metadata-only auditing (no passwords logged)

Security Considerations

Cryptographic Security

  • Secure Randomness: Uses crypto/rand for all random number generation, ensuring cryptographically secure randomness
  • Fisher-Yates Shuffle: Implements a secure shuffle algorithm with crypto/rand for password randomization

Clipboard Security

  • Automatic Clearing: When using --copy, passwords are automatically cleared from the clipboard after 60 seconds
  • Secure Implementation: Uses well-established clipboard libraries with proper error handling

Installation and Build Instructions

Prerequisites

  • Go 1.17 or later
  • Git

Build the Project

# Build the binary
make build

# Run the binary
make run

Usage Examples

Basic Password Generation

# Generate a 16-character password with all character types (default)
./passgen

# Generate a 32-character password for high-security applications
./passgen --length 32

Character Set Configuration

# Generate password without symbols
./passgen --no-symbols

# Generate password with only lowercase letters and digits
./passgen --no-symbols --no-uppercase

# Generate password with only lowercase letters (minimum complexity)
./passgen --no-symbols --no-digits --no-uppercase

# Generate password without digits (letters and symbols only)
./passgen --no-digits

Clipboard Integration

# Generate password and copy to clipboard (auto-clears after 60 seconds)
./passgen --copy

# Generate 20-character password and copy to clipboard
./passgen --length 20 --copy

# Generate password without symbols and copy to clipboard
./passgen --no-symbols --copy

Configuration Options

Flag Description Default
--length Password length (4-256 characters) 16
--no-uppercase Disable uppercase letters false
--no-digits Disable digits false
--no-symbols Disable symbols false
--copy Copy to clipboard and clear after 60 seconds false

Character Sets

  • Lowercase: abcdefghijklmnopqrstuvwxyz
  • Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Digits: 0123456789
  • Symbols: !@#$%^&*()_+-=[]{}|;:,.<>?

Security Best Practices

  1. Use Adequate Length: Generate passwords of at least 12 characters for general use, 20+ for sensitive applications
  2. Include All Character Types: Use all character types for maximum entropy unless constrained by system requirements
  3. Leverage Clipboard Feature: Use --copy for sensitive environments to avoid passwords remaining in terminal history
  4. Regular Rotation: Generate new passwords regularly for critical systems
  5. Avoid Reuse: Generate unique passwords for each service or application

Testing and Validation

PassGen includes comprehensive test coverage:

  • Unit Tests: Edge cases, error conditions, and complexity guarantees
  • Benchmark Tests: Performance measurement and regression detection
  • Integration Tests: CLI functionality and end-to-end validation

Run tests with:

# Run all tests
make test

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

A secure, cryptographically-random password generator CLI tool.

Topics

Resources

Stars

Watchers

Forks

Contributors