forked from D4Vinci/CWFF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
filter.py
29 lines (29 loc) · 849 Bytes
/
filter.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
import filter_model
from cwff import *
try:
infile = sys.argv[1]
outfile = sys.argv[2]
except:
print(f"{color.red} [!] Correct usage: python filter.py wordlist.txt output.txt")
sys.exit(0)
else:
try:
with open(infile) as f:
endpoints = set(f.read().split("\n"))
except:
print(f"{color.red} [!] Can't read file!")
sys.exit(0)
else:
try:
collect = collector("")
collect.endpoints = endpoints
collect.remove_endpoints(filter_model.exclude_endswith, filter_model.exclude_contain, filter_model.remove_regex)
except Exception as e:
print(f"{color.red} [!] Something went wrong!")
print(e)
else:
with open(outfile, "w") as f:
for endpoint in sorted(collect.endpoints):
f.write(endpoint+"\n")
sys.stdout.write(f"{color.green}[+]{color.reset} Written new endpoints to {outfile}\n")
sys.stdout.flush()