Repository navigation
Expand file tree
/
Copy pathPasswordManagerPro.py
More file actions
161 lines (112 loc) · 4.62 KB
/
Copy pathPasswordManagerPro.py
File metadata and controls
161 lines (112 loc) · 4.62 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#password using lenght only || password using letters_Num , Punctions_Num , Numbers_Num
#Get User Mode Quik , Advanced
#If quik
#function for generate password
#
#if advanced
# function for generate pass
import random
import string
def Get_User_Mode():
print('''
[+] 1.Generate a Strong Password Automaticaly
[+] 2.Generate a Password Using Lenght only
[+] 3.Advenced Options
[+] 4.Exit
''')
while True:
print('------------------------------')
Password_Mode = input('Choose 1 or 2 or 3 or 4: \n')
if Password_Mode not in ['1','2','3','4']:
print('------------------------------')
print('[!] Invalid Value')
continue
if Password_Mode == '1':
return 'auto'
elif Password_Mode == '2':
return 'quik'
elif Password_Mode == '3':
return 'advanced'
else:
quit()
def Get_Pass_Lenght():
while True:
try:
Lenght = int(input('Enter the Lenght of the Password: '))
except ValueError:
print('Invalid Value')
continue
if Lenght <=0:
print('Must be more than 0')
continue
return Lenght
def Get_Advanced_Values():
while True:
try:
Capittle_Letters=int(input('Enter the number of Capittle Letters: '))
except ValueError:
print('Invalid Value')
continue
try:
Lower_Letters = int(input('Enter the number of Lower Letters: '))
except ValueError:
print('Invalid Value')
continue
try:
Symboles = int(input('Enter the number of the Symboles: '))
except ValueError:
print('Invalid Value')
continue
try:
Numbers = int(input('Enter the number of the Numbers: '))
except ValueError:
print('Invalid Value')
continue
if Capittle_Letters <= 0 and Capittle_Letters == Lower_Letters == Symboles == Numbers:
print('You must Enter a number')
continue
return Capittle_Letters , Lower_Letters , Symboles ,Numbers
def Generate_Advanced_Password(Num_Cap_Letters , Num_Low_Letters , Num_Symboles , Num_Numbers):
Cap_Letters = random.choices(string.ascii_uppercase , k=Num_Cap_Letters)
Low_Letters = random.choices(string.ascii_lowercase , k=Num_Low_Letters)
Symboles = random.choices(string.punctuation , k=Num_Symboles)
Numbers = random.choices(string.digits , k=Num_Numbers)
Cap_Letters.extend(Low_Letters)
Cap_Letters.extend(Symboles)
Cap_Letters.extend(Numbers)
random.shuffle(Cap_Letters)
return ''.join(Cap_Letters)
def Generate_Pass_Auto():
random_letters = random.choices(string.ascii_letters , k=random.randint(3,6))
random_numbers = random.choices(string.digits , k=random.randint(3,6))
random_symboles = random.choices(string.punctuation , k= random.randint(3,6))
Password = random_letters + random_numbers + random_symboles
random.shuffle(Password)
return ''.join(Password)
def Generate_Quik_Password(Lenght):
Caracters = string.ascii_letters + string.punctuation + string.digits
Random_Characters = random.choices(Caracters , k=Lenght)
random.shuffle(Random_Characters)
return ''.join(Random_Characters)
def main():
while True:
User_Mode=Get_User_Mode()
if User_Mode=='advanced':
Capittle_Letters , Lower_Letters,Symboles,Numbers = Get_Advanced_Values()
Password = Generate_Advanced_Password(Capittle_Letters , Lower_Letters , Symboles , Numbers)
print('/n==================================')
print(f'Your Password: {Password}')
print('====================================/n')
elif User_Mode == 'quik':
Pass_Lenght = Get_Pass_Lenght()
Password = Generate_Quik_Password(Pass_Lenght)
print('/n==================================')
print(f'Your Password: {Password}')
print('====================================/n')
else:
Password = Generate_Pass_Auto()
print('/n==================================')
print(f'Your Password: {Password}')
print('====================================/n')
if __name__ == '__main__':
main()