-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
query.py
63 lines (52 loc) · 1.57 KB
/
query.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
"""
we gon die v1
"""
import re
import sys
import os
def resort(words):
words.sort()
words = sorted(words, key=len)
with open('wordlist.txt', 'w') as file:
file.writelines("%s\n" % word for word in words)
return words
def find(words, size):
return filter(lambda x: len(x)==size, words)
with open('wordlist.txt') as file:
words = file.read().splitlines()
os.system('cls' if os.name == 'nt' else 'clear')
exit = 0
print("==[ srkibblio cheater by gid ]==\n")
while exit == 0:
command = input("enter query > ")
if command == "sort":
words = resort(words)
print("words resorted.", len(words), "in database")
elif command == "add":
word = input("add word > ")
if word not in words:
words.append(word.lower())
else:
print("already in database. doing nothing.")
elif command == "clear":
os.system('cls' if os.name == 'nt' else 'clear')
print("cheater is online.\n")
elif command in ["exit", "quit"]:
resort(words)
os.system('cls' if os.name == 'nt' else 'clear')
sys.exit("goodbye!")
else:
try:
size = int(command)
found = find(words, size)
for word in found:
print("", word)
except:
try:
command = command.replace("?", ".")
for word in words:
if re.fullmatch(command, word) != None:
print("", word)
pass
except:
pass