#!/usr/bin/env python
import os
import string
import argparse

ALPHABET = string.ascii_letters + string.punctuation + string.digits
M = len(ALPHABET)
parser = argparse.ArgumentParser(description='A tool for make stupid passwords.',
                                 epilog='Dedicated to every website with shitty password requirements.')
parser.add_argument('--length', '-l', help='The number of characters for the password.', type=int, default=15)


def get_random_password(length):
    seed = os.urandom(length)
    result = bytearray(length)
    for i in range(length):
        result[i] = ALPHABET[ord(seed[i])%M]
    return result.decode('ascii')


def main():
    args = parser.parse_args()
    print get_random_password(args.length)

if __name__ == '__main__':
    main()
