Last active
October 8, 2021 22:00
-
-
Save markjenkins/e08fbed431fee03135bcb10283a8fcf8 to your computer and use it in GitHub Desktop.
wordlist based password generators
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 __future__ import print_function | |
from random import SystemRandom | |
from os.path import join, dirname | |
sysrandom = SystemRandom() | |
NUM_WORDS = 4 | |
with open( join(dirname(__file__), 'wordlist.txt') ) as f: | |
words = [word.strip() for word in f] | |
print(' '.join( sysrandom.choice(words) for x in range(NUM_WORDS) ) ) |
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 __future__ import print_function | |
from random import SystemRandom | |
from os.path import join, dirname | |
from sys import argv | |
sysrandom = SystemRandom() | |
try: | |
NUM_WORDS = int(argv[1]) | |
except ValueError: | |
NUM_WORDS = 4 | |
except IndexError: | |
NUM_WORDS = 4 | |
with open( join(dirname(__file__), 'wordlist.txt') ) as f: | |
words = [word.strip() for word in f] | |
print(' '.join( sysrandom.choice(words) for x in range(NUM_WORDS) ) ) |
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 python | |
from __future__ import print_function | |
from random import SystemRandom | |
from os.path import join, dirname | |
from sys import argv | |
sysrandom = SystemRandom() | |
NUM_WORDS = int(argv[1]) | |
with file( argv[2] ) as f: | |
words = [word.strip() for word in f] | |
print(' '.join( sysrandom.choice(words) for x in xrange(NUM_WORDS) ) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment