-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
config.py
99 lines (64 loc) · 2.33 KB
/
config.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
"""
Configures the Open Crawler v 1.0.0
"""
from rich import print
import getpass
import json
import os
print("[blue][bold]Configuring Open Crawler v 0.0.1[/bold] - File : config.json[/blue]")
if os.path.exists("config.json"):
print("[yellow] config.json already found , do you want to rewrite it ? [y/n][/yellow]", end="")
res = input(" ").lower()
if res == "y":
os.remove("config.json")
else:
exit()
configs = {}
print("\n[green]-----------------------------Writing to config.json-----------------------------[/green]\n")
print("[dark_orange] [?] MongoDB's Password ?[/dark_orange]", end="")
configs.setdefault("MONGODB_PWD", getpass.getpass(prompt=" "))
print("[dark_orange] [?] URI Provided By MongoDB ?[/dark_orange]", end="")
configs.setdefault("MONGODB_URI", input(" "))
print("[dark_orange] [?] Timeout For Requests ?[/dark_orange]", end="")
configs.setdefault("TIMEOUT", int(input(" ")))
print("[dark_orange] [?] Maximum Threads To Be Used ?[/dark_orange]", end="")
configs.setdefault("MAX_THREADS", int(input(" ")))
print("[dark_orange] [?] Flaged/Bad words list (enter for default) ?[/dark_orange]", end="")
res = input(" ")
if res == "":
res = "bad_words.txt"
configs.setdefault("bad_words", res)
print("[dark_orange] [?] Use Proxies (y/n) ?[/dark_orange]", end="")
res = input(" ").lower()
if res == "y":
res = True
else:
res = False
configs.setdefault("USE_PROXIES", res)
print("[dark_orange] [?] Scan Bad Words (y/n) ?[/dark_orange]", end="")
res = input(" ").lower()
if res == "y":
res = True
else:
res = False
configs.setdefault("Scan_Bad_Words", res)
print("[dark_orange] [?] Scan Top Keywords (y/n) ?[/dark_orange]", end="")
res = input(" ").lower()
if res == "y":
res = True
else:
res = False
configs.setdefault("Scan_Top_Keywords", res)
print("[dark_orange] [?] Scan URL For Malicious Stuff (y/n) ?[/dark_orange]", end="")
res = input(" ").lower()
if res == "y":
res = True
else:
res = False
configs.setdefault("URL_SCAN", res)
print("[dark_orange] [?] UrlScan API Key (If not scanning just enter) ?[/dark_orange]", end="")
configs.setdefault("urlscan_key", input(" "))
print("\n[green]Saving--------------------------------------------------------------------------[/green]\n")
f = open("config.json", "w")
f.write(json.dumps(configs))
f.close()