forked from hastagAB/Awesome-Python-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPasswordGenerator.py
60 lines (41 loc) · 1.94 KB
/
PasswordGenerator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import random
chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()-=_+`~[]{]\|;:,<.>/?'
welcomeMessage = "Welcome to the Password Generator!"
detailsMessage = "This program will generate a secure password using a random arrangement of letters (CAPS ON & caps off), numbers, and punctuations."
creatorMessage = "Created by Professor Renderer on October 3rd, 2018."
print(welcomeMessage + '\n' + detailsMessage + '\n' + creatorMessage + '\n')
exitMessage = 0
passwordGeneratorUsage = 1
passwordGeneratorPrompt = 1
while exitMessage != 1:
while passwordGeneratorUsage == 1:
passwordGeneratorPrompt = 1
passwordNum = input('How many passwords would you like to generate? ')
passwordNum = int(passwordNum)
passwordLength = input('How long will the password(s) be? ')
passwordLength = int(passwordLength)
print('\n')
print('Here are your password(s): \n')
passwordFile = open('Passwords.txt', 'w')
for p in range(passwordNum):
password = ''
for c in range(passwordLength):
password += random.choice(chars)
print(password)
passwordFile.write(password + '\n')
passwordFile.close()
print('\n')
while passwordGeneratorPrompt == 1:
getContinue = input('Do you want to use the Password Generator again? (Y/N)')
print('\n')
if getContinue == "Y" or getContinue == "y":
passwordGeneratorPrompt = 0
print('\n')
elif getContinue == "N" or getContinue == "n":
exitMessage = 1
passwordGeneratorUsage = 0
passwordGeneratorPrompt = 0
else:
print("Please enter 'Y' or 'N.'\n")
print('\n')
print('Thank you for using the Password Generator. Have a nice day!')