Last active
December 31, 2019 15:24
-
-
Save UnixSage/5fabb133fee29bdffb50e2ef199bb923 to your computer and use it in GitHub Desktop.
Generate random word password that are "Datacenter Compatable" meaning realistically typable into a console.
This file contains 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/env python3 | |
from random import choice,shuffle | |
import string | |
password=[] | |
words=[] | |
shortwords=[] | |
wordfile=open("/usr/share/dict/words") | |
for word in wordfile: | |
word=word.strip(string.punctuation) | |
word=word.strip(string.digits) | |
word=word.capitalize() | |
word=word.strip() | |
if len(word) > 7: | |
words.append(word) | |
else: | |
shortwords.append(word) | |
wordfile.close | |
shuffle(shortwords) | |
newword="" | |
for word in shortwords: | |
newword=newword+word | |
if len(newword) > 9: | |
words.append(newword) | |
newword="" | |
print("Word Pool Size: %s" % (len(words))) | |
password.append(choice(words)) | |
password.append(choice(string.punctuation)) | |
password.append(choice(string.digits)) | |
password.append(choice(string.digits)) | |
password.append(choice(words)) | |
print("".join(password)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment