Created
February 28, 2016 17:16
-
-
Save Jacajack/fea8847fd7469e059b43 to your computer and use it in GitHub Desktop.
Python dictionary password generator (like correct horse battery staple)
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/python | |
import random; | |
import sys; | |
Words = [Word.rstrip( '\n' ) for Word in open( "/usr/share/dict/american-english") ]; | |
Length = raw_input( "How many words should Your xkcd like password have? " ); | |
try: | |
Length = int( Length ); | |
except: | |
print( "Please enter a valid integer number!" ); | |
Length = 0; | |
Password = ""; | |
for i in range( Length ): | |
Password += ( '\x1b[3' + str( 1 + i % 7 ) + ';1m' ); | |
Password += ( Words[random.randrange(0, len( Words ) ) ] ); | |
print( Password ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment