-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGen.py
More file actions
69 lines (57 loc) · 1.93 KB
/
Gen.py
File metadata and controls
69 lines (57 loc) · 1.93 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
import random as r
import List_and_tuples
import itertools
def ran():
try:
n = r.randint(0, len(List_and_tuples.List) - 1)
for key,v in List_and_tuples.List.items():
if n == key:
return v
except:
print("Random Failed")
def gen(times, t):
try:
_times = times
_t = t
# So the string array isn't empty
List_and_tuples.Password_Gen.append(ran())
# print(f"Starting: {List_and_tuples.Password[0]}")
while _times > 0:
n = ran()
l = List_and_tuples.Password_Gen[len(List_and_tuples.Password_Gen) - 1]
# Turn Upper or Lower Letters
upper = r.randint(0,1)
# print(upper)
if upper:
try:
n = n.upper()
except:
n = n
# Check if letter,num or char was used last
if n != l:
List_and_tuples.Password_Gen.append(n)
_times -= 1
except:
print("Generate Failed")
def check(symbol, number, letters_lower, letters_upper):
try:
# Compare the password list to the other tuples
for p, s, n, l, L in itertools.product(List_and_tuples.Password_Gen, List_and_tuples.Symbols,
List_and_tuples.Numbers,
List_and_tuples.letters, List_and_tuples.Letters):
# Check if there is at least 1 Symbol
if p == s:
symbol = True
# Check if there is at least 1 Number
if p == n:
number = True
if p == l:
letters_lower = True
if p == L:
letters_upper = True
if symbol & number & letters_lower & letters_upper:
return True
else:
return False
except:
print("Check Failed")