-
Notifications
You must be signed in to change notification settings - Fork 6
/
config.php-dist
229 lines (194 loc) · 9.21 KB
/
config.php-dist
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
219
220
221
222
223
224
225
226
227
228
229
<?php
/*
* Copyright 2015, 2023 Shaun Cummiskey, <[email protected]> <https://shaunc.com>
* Repository: <https://github.com/parseword/nolovia>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This script fetches and makes use of server lists compiled by:
*
* AdguardTeam at https://github.com/adguardteam/cname-trackers
* Paul Butler at https://github.com/paulgb/BarbBlock
* Disconnect at https://disconnect.me/
* EasyList at https://github.com/easylist/easylist
* Peter Lowe at http://pgl.yoyo.org/adservers/
* Dan Pollock at http://someonewhocares.org/hosts/
* Malicious Hosts Blocklist at https://malware-filter.gitlab.io/
* Spammer Slapper at http://spammerslapper.com/
* Vetyt Yhonay at https://github.com/Yhonay/antipopads/
* Willem de Groot at https://github.com/gwillem/magento-malware-scanner
* ZeroDot1 at https://zerodot1.gitlab.io/CoinBlockerListsWeb/
*/
require_once('./model/ResolverConfiguration.php');
require_once('./model/ServerList.php');
//Enabling debug mode makes the script more chatty
define('DEBUG', true);
$DEBUG = !DEBUG ? null : array(
'domainCount' => array(),
//Enable this to print a list of all domains, with a count of blocked hosts
//in each. Useful for finding domains you may want to block entirely.
'printDomainCount' => false,
);
//Only retrieve external host lists if the local copy is older than this interval
define('FETCH_INTERVAL', time()-43200);
//Passing "force" on the command line will override the FETCH_INTERVAL setting
define('FORCE_FETCH', isset($argv) && in_array('force', $argv));
//How many times should we try to fetch a list before giving up due to failure?
define('FETCH_ATTEMPTS', 3);
//Should failure to fetch one of the server lists be considered a fatal error?
define('FETCH_FAILURE_FATALITY_FLAG', true);
//Recognize some TLDs with more than one part, e.g. com.au
define('REGEX_MULTIPART_TLD',
'/\.(com?|org?|inc)\.(ar|au|bo|br|cc|cn|co|id|il|in|hk|jp|kr|kz|mx|nz|ph|pt|rs|tr|ua|uk|uy|vn|za)$/');
//Should we send a non-blank User-Agent when fetching web resources?
ini_set("user_agent", "Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0");
//Set up the resolvers we're going to generate config files for
$resolvers = array();
//BIND style zone file (enabled by default)
$r = new ResolverConfiguration('bind');
$r->setEnabled(true);
$r->setFilePath('./blackhole.conf');
$r->setZoneDefinitionTemplate('zone "%HOST%" IN { type master; notify no; '
. 'file "blackhole.zone"; allow-query { recursers; }; };');
$resolvers[] = $r;
//BIND style RPZ file (enabled by default)
$r = new ResolverConfiguration('rpz');
$r->setEnabled(true);
$r->setFilePath('./blackhole.rpz');
$r->setZoneDefinitionTemplate("%HOST% IN CNAME .\n*.%HOST% IN CNAME .");
$resolvers[] = $r;
//nsd (disabled by default)
$r = new ResolverConfiguration('nsd');
$r->setEnabled(false);
$r->setFilePath('./blackhole-nsd.conf');
$r->setZoneDefinitionTemplate('zone: name: "%HOST%" zonefile: "blackhole.zone"');
$resolvers[] = $r;
//Plaintext host list output (disabled by default)
$r = new ResolverConfiguration('hostlist');
$r->setEnabled(false);
$r->setFilePath('./blackhole-hostlist.txt');
$r->setZoneDefinitionTemplate('%HOST%');
$resolvers[] = $r;
unset($r);
//Set up the server lists we're going to fetch. To disable a particular list,
//comment out the block that defines it.
$serverLists = array();
$sl = new ServerList('nolovia Windows Telemetry');
$sl->setFilePath('./data/hosts-windows-telemetry.txt');
$sl->setUri('https://raw.githubusercontent.com/parseword/nolovia/master/skel/hosts-windows-telemetry.txt');
$serverLists[] = $sl;
$sl = new ServerList('nolovia State-sponsored Malware');
$sl->setFilePath('./data/hosts-government-malware.txt');
$sl->setUri('https://raw.githubusercontent.com/parseword/nolovia/master/skel/hosts-government-malware.txt');
$serverLists[] = $sl;
$sl = new ServerList('nolovia Acoustic/Silverpop Marketing');
$sl->setFilePath('./data/hosts-silverpop.txt');
$sl->setUri('https://raw.githubusercontent.com/parseword/nolovia/master/skel/hosts-silverpop.txt');
$serverLists[] = $sl;
$sl = new ServerList('nolovia Dynamic DNS Providers');
$sl->setFilePath('./data/hosts-dynamic-dns.txt');
$sl->setUri('https://raw.githubusercontent.com/parseword/nolovia/master/skel/hosts-dynamic-dns.txt');
$serverLists[] = $sl;
$sl = new ServerList('nolovia Supplemental Bad Host Index');
$sl->setFilePath('./data/hosts-nolovia.txt');
$sl->setUri('https://raw.githubusercontent.com/parseword/nolovia/master/skel/hosts-nolovia.txt');
$serverLists[] = $sl;
$sl = new ServerList('AdguardTeam CNAME Tracker List');
$sl->setFilePath('./data/hosts-adguard-cname.txt');
$sl->setUri('https://raw.githubusercontent.com/AdguardTeam/cname-trackers/master/combined_disguised_trackers_justdomains.txt');
$sl->setMinimumExpectedBytes(10240);
$sl->setValidationText('AdGuard CNAME');
$serverLists[] = $sl;
$sl = new ServerList('antipopads List from Yhonay');
$sl->setFilePath('./data/hosts-antipopads.txt');
$sl->setUri('https://raw.githubusercontent.com/Yhonay/antipopads/master/hosts');
$sl->setMinimumExpectedBytes(10240);
$sl->setValidationText('0.0.0.0');
$sl->setReplacePatterns(array('|^0.0.0.0(\s+)|m'));
$serverLists[] = $sl;
$sl = new ServerList('BarbBlocker from paulgb');
$sl->setFilePath('./data/hosts-barbblocker.txt');
$sl->setUri('https://paulgb.github.io/BarbBlock/blacklists/domain-list.txt');
$sl->setMinimumExpectedBytes(1024);
$sl->setValidationText('functionalclam');
$serverLists[] = $sl;
$sl = new ServerList('CoinBlockerList from ZeroDot1');
$sl->setFilePath('./data/hosts-coinblocker.txt');
$sl->setUri('https://gitlab.com/ZeroDot1/CoinBlockerLists/raw/master/list.txt');
$sl->setMinimumExpectedBytes(2048);
$sl->setValidationText('bitcoin');
$serverLists[] = $sl;
$sl = new ServerList('Disconnect Malvertising');
$sl->setFilePath('./data/hosts-disconnect-malvertising.txt');
$sl->setUri('https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt');
$sl->setMinimumExpectedBytes(32768);
$sl->setValidationText('2o7.net');
$serverLists[] = $sl;
$sl = new ServerList('Easylist Popups');
$sl->setFilePath('./data/hosts-easylist-popups.txt');
$sl->setUri('https://raw.githubusercontent.com/easylist/easylist/master/easylist/easylist_adservers_popup.txt');
$sl->setMinimumExpectedBytes(10240);
$sl->setValidationText('popup');
$sl->setMatchAllPattern('/\|\|(.*[a-z].*?)\^\$popup/i');
$serverLists[] = $sl;
$sl = new ServerList('EasyPrivacy Tracking Server List');
$sl->setFilePath('./data/hosts-easyprivacy-tracking.txt');
$sl->setUri('https://raw.githubusercontent.com/easylist/easylist/master/easyprivacy/easyprivacy_trackingservers.txt');
$sl->setMinimumExpectedBytes(10240);
$sl->setValidationText('2o7.net');
$sl->setMatchAllPattern('~\|\|(.*?)\^\$third-party~');
$serverLists[] = $sl;
$sl = new ServerList('hpHosts Legacy Backup');
$sl->setFilePath('./data/hosts-hphosts.txt');
$sl->setUri('https://raw.githubusercontent.com/parseword/nolovia/master/skel/hosts-hphosts-legacy.txt');
$sl->setMinimumExpectedBytes(512000);
$sl->setValidationText('2o7.net');
$sl->setReplacePatterns(array('|^127.0.0.1(\s+)|m', '|\.$|m'));
$serverLists[] = $sl;
$sl = new ServerList('Magento Malware List from gwillem');
$sl->setFilePath('./data/hosts-magento-malware.txt');
$sl->setUri('https://raw.githubusercontent.com/gwillem/magento-malware-scanner/master/rules/burner-domains.txt');
$sl->setMinimumExpectedBytes(1024);
$sl->setValidationText('mage');
$serverLists[] = $sl;
$sl = new ServerList('Malicious Hosts Blocklist');
$sl->setFilePath('./data/hosts-malicious-hosts-blocklist.txt');
$sl->setUri('https://malware-filter.gitlab.io/malware-filter/urlhaus-filter-hosts.txt');
$sl->setMinimumExpectedBytes(10240);
$sl->setValidationText('Malicious Hosts Blocklist');
$sl->setReplacePatterns(array('|^0.0.0.0(\s+)|m'));
$serverLists[] = $sl;
$sl = new ServerList('pgl.yoyo.org');
$sl->setFilePath('./data/hosts-yoyo.txt');
$sl->setUri('http://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml&mimetype=plaintext');
$sl->setMinimumExpectedBytes(30720);
$sl->setValidationText('2o7.net');
$serverLists[] = $sl;
$sl = new ServerList('someonewhocares.org');
$sl->setFilePath('./data/hosts-someonewhocares.txt');
$sl->setUri('http://someonewhocares.org/hosts/hosts');
$sl->setListStartDelimiter('ad-sites');
$sl->setListEndDelimiter('/ad-sites');
//$sl->setListStartDelimiter('#<ad-sites>');
//$sl->setListEndDelimiter('#</ad-sites>');
$sl->setValidationText('2o7.net');
$sl->setReplacePatterns(array('|^127.0.0.1(\s+)|m'));
$serverLists[] = $sl;
$sl = new ServerList('Spammer Slapper');
$sl->setFilePath('./data/hosts-spammerslapper.txt');
$sl->setUri('http://spammerslapper.com/downloads/adblock_include.conf');
$sl->setListEndDelimiter('//End Ad Blocking');
$sl->setValidationText('2o7.net');
$sl->setMatchAllPattern('|zone "(.*?)"|');
$serverLists[] = $sl;
unset($sl);