Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- import random
- oddPasswords = ['12345', 'I have a secret password!', '1hi5 15 4 53CR31 P455W0RD', 'HAHAHA']
- alpha = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
- passwordFile = open('C:\My Stuff\SecretPasswordFile.txt')
- secretPassword = passwordFile.read()
- print('Enter your password.')
- typedPassword = input()
- if typedPassword == secretPassword:
- print('Access granted')
- print('Would you like a random password suggestion generator', 'Yes or No')
- permissionRandomGenerator = input().lower()
- print('How long do you want your password?')
- lengthRandomGenerator = int(input())
- if permissionRandomGenerator == 'yes':
- def a():
- return math.floor(random.random()*10)
- def b():
- return alpha[math.floor(random.random()*27)]
- c = []
- d = 0
- while d < lengthRandomGenerator:
- c.insert(d, a())
- d = d + 1
- c.insert(d, b())
- d = d + 1
- d = 0
- if lengthRandomGenerator <= 0:
- print('It has to be longer than that')
- elif lengthRandomGenerator >= 25:
- print('I can\'t generate a password that long')
- elif math.isnan(lengthRandomGenerator):
- print('error: not valid data type')
- else:
- while d < (len(c)-1):
- e = c[d]
- print(e)
- d = d + 1
- d = 0
- c = []
- elif permissionRandomGenerator == 'no':
- print('Too bad...')
- else:
- print('You had to answer Yes or No')
- for w in oddPasswords:
- if w == typedPassword:
- print('BTW:')
- break
- if typedPassword == '12345':
- print('That password is one that an idiot puts on their luggage.')
- if typedPassword == 'I have a secret password!':
- print('Yes you do!')
- if typedPassword == '1hi5 15 4 53CR31 P455W0RD':
- print('Don\'t use machine generated passwords.')
- if typedPassword == 'HAHAHA':
- print('Passwords are know laughing matter')
- else:
- if typedPassword == '12345':
- print('How simple do you think my password is?!')
- if typedPassword == 'HAHAHA':
- print('You won\'t be laughing long.')
- print('Access Denied')
- print('Hacker!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement