Skill: freedompixels/secure-password-tool (version 1.0.0)

--- slug: secure-password-tool name: Secure Password Generator description: "Generate cryptographically secure random passwords. Customizable length, character types, exclude similar characters. Pure Python standard library, no API key required." keywords: password, generator, security, random, secure, strong password version: "1.0.0" author: Qiance language: en --- # Secure Password Generator Generate cryptographically secure random passwords using Python's `secrets` module. No API keys, no external services, completely offline. ## Features - **Cryptographically secure**: Uses `secrets` module (not `random`) - **Customizable length**: Default 16 characters - **Character types**: Uppercase, lowercase, digits, special symbols - **Exclude similar characters**: Remove 0, O, 1, l, I to avoid confusion - **Batch generation**: Generate multiple passwords at once - **Pure standard library**: Zero dependencies, works offline ## Usage ```bash # Generate a 16-character password (default) python3 scripts/password_generator.py # Generate a 20-character password python3 scripts/password_generator.py 20 # Generate 10 passwords of 24 characters python3 scripts/password_generator.py 24 10 # Exclude similar characters (0O1lI) python3 scripts/password_generator.py 16 --exclude-similar # Password without special symbols python3 scripts/password_generator.py 16 --no-special ``` ## Examples ``` Generate a strong 20-character password Generate 5 passwords of 16 characters each Generate a password without special symbols for a website that doesn't allow them ``` ## Options | Option | Description | |--------|-------------| | `LENGTH` | Password length (default: 16) | | `COUNT` | Number of passwords to generate (default: 1) | | `--no-upper` | Exclude uppercase letters | | `--no-lower` | Exclude lowercase letters | | `--no-digits` | Exclude digits | | `--no-special` | Exclude special symbols | | `--exclude-similar` | Exclude 0, O, 1, l, I | ## Security Notes - Uses `secrets.choice()` for cryptographically secure randomness - Suitable for generating passwords, API keys, tokens - Not suitable for password hashing (use bcrypt/argon2 for storage) --- ## 中文说明 安全的随机密码生成器，使用Python标准库secrets模块，无需API Key。 - 默认16位强密码 - 支持自定义长度、字符类型 - 可排除相似字符（0O1lI） - 支持批量生成

path: scripts/password_generator.py
content: #!/usr/bin/env python3
"""
Secure Password Generator - Generate cryptographically secure random passwords
Uses secrets module for cryptographic security (not random)
"""
import secrets
import string
import sys
import json
import argparse

def generate_password(length=16, use_upper=True, use_lower=True, use_digits=True, use_special=True, exclude_similar=False):
    """Generate a cryptographically secure random password
    
    Args:
        length: Password length (default 16)
        use_upper: Include uppercase letters (default True)
        use_lower: Include lowercase letters (default True)
        use_digits: Include digits (default True)
        use_special: Include special symbols (default True)
        exclude_similar: Exclude similar characters 0O1lI (default False)
    
    Returns:
        str: Generated password
    """
    chars = ''
    
    if use_upper:
        chars += string.ascii_uppercase
    if use_lower:
        chars += string.ascii_lowercase
    if use_digits:
        chars += string.digits
    if use_special:
        chars += '!@#$%^&*()_+-=[]{}|;:,.<>?'
    
    if exclude_similar:
        similar = '0O1lI'
        chars = ''.join(c for c in chars if c not in similar)
    
    if not chars:
        chars = string.ascii_letters + string.digits
    
    # Use secrets.choice for cryptographic security
    return ''.join(secrets.choice(chars) for _ in range(length))

def main():
    parser = argparse.ArgumentParser(
        description='Generate cryptographically secure random passwords',
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog="""
Examples:
  python3 password_generator.py
  python3 password_generator.py 20
  python3 password_generator.py 24 10
  python3 password_generator.py 16 --exclude-similar
  python3 password_generator.py 16 --no-special
        """
    )
    
    parser.add_argument('length', type=int, nargs='?', default=16, help='Password length (default: 16)')
    parser.add_argument('count', type=int, nargs='?', default=1, help='Number of passwords (default: 1)')
    parser.add_argument('--no-upper', action='store_true', help='Exclude uppercase letters')
    parser.add_argument('--no-lower', action='store_true', help='Exclude lowercase letters')
    parser.add_argument('--no-digits', action='store_true', help='Exclude digits')
    parser.add_argument('--no-special', action='store_true', help='Exclude special symbols')
    parser.add_argument('--exclude-similar', action='store_true', help='Exclude similar characters (0O1lI)')
    parser.add_argument('--json', action='store_true', help='Output as JSON')
    
    args = parser.parse_args()
    
    # Generate passwords
    passwords = [
        generate_password(
            args.length,
            use_upper=not args.no_upper,
            use_lower=not args.no_lower,
            use_digits=not args.no_digits,
            use_special=not args.no_special,
            exclude_similar=args.exclude_similar
        )
        for _ in range(args.count)
    ]
    
    result = {
        'count': args.count,
        'length': args.length,
        'passwords': passwords,
        'options': {
            'uppercase': not args.no_upper,
            'lowercase': not args.no_lower,
            'digits': not args.no_digits,
            'special': not args.no_special,
            'exclude_similar': args.exclude_similar
        }
    }
    
    if args.json:
        print(json.dumps(result, indent=2))
    else:
        if args.count == 1:
            print(f"🔐 Generated password ({args.length} chars):")
            print(f"   {passwords[0]}")
        else:
            print(f"🔐 Generated {args.count} passwords ({args.length} chars each):")
            for i, pwd in enumerate(passwords, 1):
                print(f"   {i}. {pwd}")

if __name__ == '__main__':
    main()


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)