Created
April 2, 2019 22:02
-
-
Save mplovepop/bc4a9b5bd89cdf1d02ba4b27db8d0f5b to your computer and use it in GitHub Desktop.
~/.local/bin/mkpass
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os, sys, random, string | |
length = int(sys.argv[1]) if len(sys.argv) > 1 else 4 | |
if length < 8: | |
with open('/usr/share/dict/words', 'r') as f: | |
choice_list = [l.strip() for l in f.readlines()] | |
ch = ' ' | |
else: | |
choice_list = string.ascii_letters + string.digits + '!@#$%^&*()' | |
ch = '' | |
random.seed = (os.urandom(1024)) | |
print ch.join(random.choice(choice_list) for i in range(length)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment