Skip to content

Instantly share code, notes, and snippets.

@evanwike
Created August 30, 2016 06:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanwike/3f856247562f947f4f930574d6a9b3fa to your computer and use it in GitHub Desktop.
Save evanwike/3f856247562f947f4f930574d6a9b3fa to your computer and use it in GitHub Desktop.
Password Generator 2000
import random
def passgen():
lower = 'abcdefghijklmnopqrstuvwxyz'
upper = lower.upper()
number = '1234567890'
special = '~!@#$%^&*()_-+=}{|[]\?/:;\'<>,.'
password = ''
strength = ''
print('- Password Generator 2000 -')
print('Please enter the desired amounts for each character.')
ll = int(input('(Lower-case letters?)'))
ul = int(input('(Upper-case letters?)'))
num = int(input('(Numbers?)'))
sc = int(input('(Special characters?)'))
for i in range(0,ll):
password += random.choice(lower)
for i in range(0,ul):
password += random.choice(upper)
for i in range(0,num):
password += random.choice(number)
for i in range(0,sc):
password += random.choice(special)
if ul >= 2 and num >= 2 and sc >= 2:
strength = 'Strong'
elif ul >= 2 and num >= 2 and sc < 2:
strength = 'Medium'
elif ul < 2 and num >= 2 and sc >= 2:
strength = 'Medium'
elif ul >= 2 and num < 2 and sc >= 2:
strength = 'Medium'
elif ul >= 2 and num < 2 and sc < 2:
strength = 'Medium/Weak'
elif ul < 2 and num >= 2 and sc < 2:
strength = 'Medium/Weak'
elif ul < 2 and num < 2 and sc >= 2:
strength = 'Medium/Weak'
elif ul < 2 and num < 2 and sc < 2:
strength = 'Medium/Weak'
else:
strength = 'Weak'
print('Your password is:')
print('--> ' + password + ' <--' + ' | ' + strength)
if strength == 'Medium/Weak' or strength == 'Weak':
print('********************************************************')
print('You can improve your password by adding at least 2 upper-case letters/numbers/special characters These, combined with a few lower case letters, would be virtually impossible to brute-force. You could also try making the password longer.')
print('********************************************************')
else:
print('------------------------------------------')
newpass = str(input('Would you like to generate a different password (Y) or (N)?')).upper()
if newpass == 'Y':
passgen()
passgen()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment