Created
December 22, 2014 20:09
-
-
Save plesiv/821afcf21d767d9be0c4 to your computer and use it in GitHub Desktop.
Very simple (configurable) random password generator
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 | |
""" | |
Configurable password generator | |
Usage instructions: | |
1. Configure generator by modifying values below | |
2. Execute script | |
""" | |
from random import shuffle | |
from random import choice | |
#---------------------------------------------------------------------- | |
# Config | |
num = { 'upper' : 4, | |
'lower' : 4, | |
'digit' : 3, | |
'spchr' : 2 | |
} | |
let = { 'upper' : 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', | |
'lower' : 'abcdefghijklmnopqrstuvwxyz', | |
'digit' : '0123456789', | |
'spchr' : '!@#$%^&()-_=+[]{}<>' | |
} | |
#---------------------------------------------------------------------- | |
# Execute | |
passw = [ choice(let[c]) for c in let.keys() for n in range(num[c]) ] | |
shuffle(passw) | |
print(''.join(passw)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment