-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgendnsmasqconf.py
218 lines (203 loc) · 4.48 KB
/
gendnsmasqconf.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
blacklist = """
news.google.com
"""
whitelist = """
google.com
googleapis.com
gstatic.com
googleusercontent.com
khanacademy.org
kastatic.org
kasandbox.org
gmail.com
classdojo.com
apple.com
apple-dns.net
icloud.com
player.vimeo.com
opendns.com
scratch.mit.edu
q.stripe.com
quizizz.com
gvt1.com
gvt2.com
gvt3.com
myschoolapp.com
bootstrapcdn.com
static.dreambox.com
static.zdassets.com
www.amazon.com
amazonaws.com
media-amazon.com
ssl-images-amazon.com
fls-na.amazon.com
www.csus.org
www.heritagechinese.com
www.jpl.nasa.gov
www.tinkercad.com
wikipedia.org
wikimedia.org
menloschool.org
secure.gravatar.com
akamaized.net
typekit.net
vimeocdn.com
aaplimg.com
cloudfront.net
akadns.net
online-go.com
expl.ai
explaineverything.com
cdnjs.cloudflare.com
brilliant.org
www.recaptcha.net
cdn.ravenjs.com
edpuzzle.com
mysteryscience.com
mysterydoug.com
flipgrid.com
imgix.net
cdn.mxpnl.com
wistia.net
letsencrypt.org
cdn-apple.com
dreambox.com
clever.com
stream.mux.com
wistia.com
crt.comodoca.com
i.ytimg.com
goodreads.com
gr-assets.com
rackcdn.com
outschool.com
zoom.us
dndbeyond.com
cursecdn.com
gravatar.com
dogonews.com
smore.com
nytimes.com
nyt.com
sites.google.com
instructure.com
instructuremedia.com
images.unsplash.com
quizlet.com
menloschool.org
makecode.com
bookcreator.com
canvas-user-content.com
firebaseio.com
googlehosted.com
peardeck.com
azureedge.net
s-microsoft.com
padlet.org
slack.com
slack-edge.com
tinyurl.com
spotify.com
slackb.com
inscloudgate.net
waysidepublishing.com
grammarflip.com
akamaihd.net
litix.io
slideshare.net
soraapp.com
veracross.com
svc.overdrive.com
api.overdrive.com
cdnwest-xch.media.net
od-cdn.com
biglibraryread.com
menloschool.okta.com
oktacdn.com
login.okta.com
data.pendo.io
menloschool.matomo.cloud
menlocoa.org
padlet.net
indicative.com
padlet.pics
ingest.sentry.io
certify.alexametrics.com
kahoot.it
cdn.amplitude.com
static.hotjar.com
cnn.com
abcnews.go.com
abcnews.com
cdn.segment.com
warnermediacdn.com
cdn.turner.com
ixl.com
edulastic.com
biblionasium.com
digitaldialects.com
brainpop.com
myfonts.net
vimeocdn.com
squarespace-cdn.com
buzzin.live
forms.gle
firebasehostingproxy.page.link
menloschool.us6.list-manage.com
schoology.com
icloud-content.com
fulfill.contentreserve.com
tabroom.com
redirect.viglink.com
quizlet.live
codehs.com
lichess.org
lichess1.org
akamaiedge.net
fontawesome.com
images.prismic.io
imgix.net
map.fastly.net
phet.colorado.edu
socialprogress.org
purpleair.com
explorelearning.com
artofproblemsolving.com
"""
servers = ["208.67.222.222", "208.67.220.220"]
def write_conf_file(file_path):
with open(file_path, "w") as f:
f.write("""
interface=eth0 # Use interface wlan0
listen-address=192.168.11.2 # Specify the address to listen on
bind-interfaces # Bind to the interface
# REMOVE server=8.8.8.8
domain-needed # Don't forward short names
bogus-priv # Drop the non-routed address spaces.
#dhcp-range=192.168.220.50,192.168.220.150,12h # IP range and lease time
# REMOVE server=8.8.8.8
# NEW ITEMS
# Don't resolve any DNS, Blacklist all
no-resolv
# Log all queries to /var/log/daemon.log - optional but helpful
log-queries
log-facility=-
# Whitelist domains to DNS lookup
# uses opendns nameservers, substitute your choice
# google nameservers are 8.8.8.8 and 8.8.4.4
# opendns nameservers are 208.67.222.222 and 208.67.220.220
""")
for bl in blacklist.strip().split():
f.write("address=/%s/127.0.0.1\n" % (bl))
for wl in whitelist.strip().split():
for s in servers:
f.write("server=/%s/%s\n" % (wl, s))
f.write("""
# Needed if using opendns nameservers
server=/opendns.com/208.67.222.222
server=/opendns.com/208.67.220.220
# Direct all other domains to
address=/#/127.0.0.1
""")
if __name__ == "__main__":
write_conf_file("/tmp/aaadnsmasq.conf")