-
Notifications
You must be signed in to change notification settings - Fork 0
/
generator.py
68 lines (50 loc) · 1.27 KB
/
generator.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
61
62
63
64
65
66
import string
import random
'''
ALPHABETS :
'''
lowercase = string.ascii_lowercase
uppercase = string.ascii_uppercase
numbers = "0123456789"
specials = "!#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
print("lowercase : %s" % lowercase)
print("uppercase : %s" % uppercase)
print("numbers : %s" % numbers)
print("specials : %s" % specials)
print("-" * 20)
print("" * 5 + "PASSWORD GENERATOR")
print()
print("-" * 20)
print("" * 5 + "Type every number of the type of character you want to include in your password (i.e. '24'")
print()
print("" * 5 + "1 : Lowercase characters")
print("" * 5 + "2 : Uppercase characters")
print("" * 5 + "3 : Numbers")
print("" * 5 + "4 : Special characters")
print()
print("-" * 20)
print()
choice = input(" > ")
alphabet = ""
if "1" in choice:
alphabet += lowercase
if "2" in choice:
alphabet += uppercase
if "3" in choice:
alphabet += numbers
if "4" in choice:
alphabet += specials
print("-" * 20)
print("" * 5 + "How long do you want your password to be ?")
print()
print("-" * 20)
length = input(" > ")
password = ""
for i in range(1, int(length)):
j = random.randint(0, len(alphabet)-1)
password += alphabet[j]
print("-" * 20)
print("" * 5 + "Congratulations, here is your password : %s" % password)
print()
print("-" * 20)
print()