-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgoon_det.py
75 lines (59 loc) · 1.99 KB
/
goon_det.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
67
68
69
70
71
72
73
74
75
"""
Decode latex gloves fingerprints for Goon Security
"""
ALLOWED_CHARACTERS = [
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"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",
"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"
]
def match_id(prints: list) -> str:
characters = prints[0]
if len(prints) == 1:
return False
for charlist in prints[1:]:
for index, character in enumerate(charlist):
id_char = characters[index]
if character not in ALLOWED_CHARACTERS:
continue
if id_char not in ALLOWED_CHARACTERS:
characters[index] = character
continue
if character != id_char:
raise Exception(
f"Valid characters are different. Index {index}, {character} != {id_char}")
for character in characters:
if character not in ALLOWED_CHARACTERS:
return False
return ''.join(characters)
while True:
ids_list = []
while True:
all_allowed = True
id_input = input("ID: ")
if id_input in ("r", "R", "reset"):
print("Resetting")
ids_list = []
break
if len(id_input) != 32:
print(f"Length does not match. Needs 32, has {len(id_input)}")
continue
for character in id_input:
if character not in ALLOWED_CHARACTERS:
all_allowed = False
ids_list.append(list(id_input))
break
if all_allowed:
print(f"\n{id_input}")
ids_list = []
print("Resetting\n")
continue
filled_id = match_id(ids_list)
if filled_id:
print(f"\n{filled_id}")
ids_list = []
print("Resetting\n")
continue