# HG changeset patch # User Jeff Hammel # Date 1557250478 25200 # Node ID 1b6f0650dabb214d1658120b2387ad1204054c14 # Parent ff31f0975d71efc1e5f2d86fa13a7cafe250f3ad add script to generate passwords diff -r ff31f0975d71 -r 1b6f0650dabb python/generate_password.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/generate_password.py Tue May 07 10:34:38 2019 -0700 @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +import random +import string +import sys + +pool = ''.join([string.ascii_letters, + string.digits, + string.punctuation]) + +contents = [(string.ascii_lowercase, 6), + (string.ascii_uppercase, 6), + (string.punctuation, 2)] + +def password(length=16, pool=pool): + return ''.join(random.sample(pool, length)) + +def main(args=sys.argv[1:]): + """CLI""" + + print(password()) + +if __name__ == '__main__': + main()