Skip to content

Commit 1f3e486

Browse files
committed
Added Sources and sys deamon checker
1 parent 0599270 commit 1f3e486

File tree

4 files changed

+91
-17
lines changed

4 files changed

+91
-17
lines changed

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,40 @@ Enjoy a safe and faster web experience
4444
- [GNU coreutils](http://www.gnu.org/software/coreutils)
4545
- [dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html)
4646

47+
#### Sources
48+
49+
FreeContributor downloads external files; each has its own license, detailed in the list below.
50+
51+
52+
| URL | License |
53+
| ------- | ------- |
54+
|[Adaway list](https://adaway.org/hosts.txt) | |
55+
|[MVPS Hosts](http://winhelp2002.mvps.org/hosts.htm) | CC Attribution-NonCommercial-ShareAlike 4.0 |
56+
|[hpHosts’s ad and tracking servers‎](http://www.hosts-file.net/) | |
57+
|[Peter Lowe’s Ad server list](http://pgl.yoyo.org/adservers/) | |
58+
|[Dan Pollock’s hosts file](http://someonewhocares.org/hosts/) | |
59+
|[CAMELEON](http://sysctl.org/cameleon/) | |
60+
|[StevenBlack/hosts](https://github.com/StevenBlack/hosts/) | |
61+
|[quidsup/notrack](https://github.com/quidsup/notrack) | |
62+
|[gorhill's uMatrix Blocklist](https://github.com/gorhill/uMatrix/umatrix) | |
63+
|[Malware Domain List ](http://www.malwaredomainlist.com/hostslist/hosts.txt) | |
64+
|[AdBlock Manager](http://adblock.gjtech.net/?format=unix-hosts) | CC Attribution 3.0 |
65+
|[David Alexander Harvey, Henry Hertz Hobbit, Danny R Johnston and Eric Phelps](http://hostsfile.org/hosts.html) hostfile project | LGPL as GPLv2 |
66+
|[Airelle's host file](http://rlwpx.free.fr/WPFF/hosts.htm) | |
67+
|[The Hosts File Project](http://hostsfile.mine.nu) | LGPL |
68+
|[Mahakala](http://adblock.mahakala.is/) | |
69+
|[Secure Mecca](http://securemecca.com/Downloads/hosts.txt) | |
70+
|[Neocities](https://hosts.neocities.org/) | |
71+
|[spam404scamlist](http://spam404bl.com/spam404scamlist.txt) | |
72+
|[malwaredomains.lehigh.edu](http://malwaredomains.lehigh.edu/files/domains.txt) | |
73+
|[mirror1.malwaredomains.com](http://mirror1.malwaredomains.com/files/justdomains) | |
74+
|[adzhosts - 1](http://tcpdiag.dl.sourceforge.net/project/adzhosts/HOSTS.txt) | |
75+
|[adzhosts - 2](http://optimate.dl.sourceforge.net/project/adzhosts/HOSTS.txt) | |
76+
|[zeustracker](https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist)| |
77+
|[hosts.eladkarako.com](http://hosts.eladkarako.com/hosts.txt) | |
78+
|[Malekal](http: //www.malekal.com/HOSTS_filtre/HOSTS.txt) | |
79+
|[GDS Hosts File](http://accs-net.com/hosts/get_hosts.html) | |
80+
4781
## License
4882

4983
FreeContributor is licensed under the [General Public License (GPL) version 3](https://www.gnu.org/licenses/gpl.html)

conf/dnsmasq.conf

+2
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ cache-size=1000
5252
# For debugging purposes, log each DNS query as it passes through
5353
# dnsmasq.
5454
log-queries
55+
log-facility=/var/log/dnsmasq.log
5556

5657
# Log lots of extra information about DHCP transactions.
5758
log-dhcp
59+
log-async
5860

5961
# Include another lot of configuration options.
6062
conf-dir=/etc/dnsmasq.d

data/google

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#
22
# Provider: Alphabet (Google)
33
#
4+
.google
45
466453.com
56
admob.com
67
adsense.com

src/installer.sh

+54-17
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@
33
# (c) 2016 by TBDS
44
# https://github.com/tbds/FreeContributor
55
#
6+
# FreeContributor is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
610
# Simple script that pulls ad blocking host files from different providers
711
# and combines them to use as a dnsmasq resolver file.
812
#
13+
#
914
# A, --address=/<domain>/ [domain/] <ipaddr>
1015
# Specify an IP address to return for any host in the given
1116
# domains. Queries in the domains are never forwarded and always
@@ -21,18 +26,16 @@
2126
# or DHCP and not sent to an upstream nameserver by a more spe-
2227
# cific --server directive."
2328
#
24-
# FreeContributor is free software: you can redistribute it and/or modify
25-
# it under the terms of the GNU General Public License as published by
26-
# the Free Software Foundation, either version 3 of the License, or
27-
# (at your option) any later version.
28-
29+
#
30+
#
2931
# Dependencies:
3032
# * curl
3133
# * dnsmasq
3234
# * GNU coreutils
3335

34-
# Declair variables
35-
resolv=/etc/resolv.conf
36+
# variables
37+
resolvconf=/etc/resolv.conf
38+
resolvconfbak=/etc/resolv.conf.bak
3639
dnsmasqdir=/etc/dnsmasq.d
3740
dnsmasqconf=/etc/dnsmasq.conf
3841
dnsmasqconfbak=/etc/dnsmasq.conf.bak
@@ -55,28 +58,38 @@ echo "
5558
"
5659
}
5760

61+
5862
rootcheck(){
5963
if [[ $UID -ne 0 ]]; then
60-
echo "Please run this script as root"
64+
echo "You need root or su rights to access /etc directory"
65+
echo "Please run this script as root (like a boss)"
6166
exit 1
6267
fi
6368
}
6469

6570
dependencies(){
66-
programs=( wget curl sed unzip 7z dnsmasq )
71+
programs=( wget curl sed dnsmasq ) # unzip 7z
6772
for prg in "${programs[@]}"
6873
do
6974
type -P $prg &>/dev/null || { echo "Error: FreeConributor requires the program $prg... Aborting."; echo; exit 192; }
7075
done
7176
}
7277

7378
backup(){
74-
if [ ! -f "$dnsmasqconf" ] ; then
75-
echo "Backing up your previous dnsmasq file"
79+
if [ ! -f "$resolvconf" ] && [ ! -f "$dnsmasqconf" ]; then
80+
echo "Backing up your previous resolv and dnsmasq file"
81+
sudo cp $resolvconf $resolvconfbak
7682
sudo cp $dnsmasqconf $dnsmasqconfbak
7783
fi
7884
}
7985

86+
config(){
87+
if [ ! -d "$dnsmasqdir" ]; then
88+
mkdir -p "$dnsmasqdir"
89+
fi
90+
}
91+
92+
8093
download_sources(){
8194
## See FilterLists for a comprehensive list of filter lists from all over the web
8295
## https://filterlists.com/
@@ -88,15 +101,18 @@ sources=(\
88101
'http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext'\
89102
'http://someonewhocares.org/hosts/hosts'\
90103
'http://sysctl.org/cameleon/hosts' \
91-
'http://securemecca.com/Downloads/hosts.txt' \
92-
'https://raw.githubusercontent.com/StevenBlack/hosts/master/data/StevenBlack/hosts' \
93-
# 'https://hosts.neocities.org/' \
104+
'http://securemecca.com/Downloads/hosts.txt
105+
'https://raw.githubusercontent.com/gorhill/uMatrix/master/assets/umatrix/blacklist.txt' \
94106
'http://www.malwaredomainlist.com/hostslist/hosts.txt' \
95107
'http://malwaredomains.lehigh.edu/files/justdomains' \
108+
'http://www.joewein.net/dl/bl/dom-bl.txt' \
96109
'http://adblock.gjtech.net/?format=hostfile' \
110+
'https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist' \
111+
'http://adblock.mahakala.is/' \
97112
'https://raw.githubusercontent.com/quidsup/notrack/master/trackers.txt'
113+
114+
# 'https://hosts.neocities.org/' \
98115
# 'https://publicsuffix.org/list/effective_tld_names.dat' \
99-
# 'http://jansal.googlecode.com/svn/trunk/adblock/hosts' \
100116
# 'http://malwaredomains.lehigh.edu/files/justdomains' \
101117
# 'http://cdn.files.trjlive.com/hosts/hosts-v8.txt' \
102118
# 'https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt' \
@@ -108,7 +124,6 @@ sources=(\
108124
# 'https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt' \
109125
# 'http://spam404bl.com/spam404scamlist.txt' \
110126
# 'http://malwaredomains.lehigh.edu/files/domains.txt' \
111-
# 'http://www.joewein.net/dl/bl/dom-bl.txt' \
112127
# 'http://www.sa-blacklist.stearns.org/sa-blacklist/sa-blacklist.current' \
113128
# 'https://easylist-downloads.adblockplus.org/malwaredomains_full.txt' \
114129
# 'https://easylist-downloads.adblockplus.org/easyprivacy.txt' \
@@ -155,17 +170,39 @@ dnsmasq-conf(){
155170
echo domains dnsmasq-domains.conf; wc -l dnsmasq-domains.conf
156171
}
157172

173+
158174
finish(){
175+
mv domains-extracted /etc/dnsmaq.d/dnsmasq-block.conf
176+
rm tmp
159177
echo "Done"
160178
}
161179

180+
start-deamons(){
181+
#https://github.com/DisplayLink/evdi/issues/11#issuecomment-193877839
182+
183+
INIT=`ls -l /proc/1/exe`
184+
if [[ $INIT == *"systemd"* ]]; then
185+
systemctl enable dnsmasq.service && systemctl start dnsmasq.service
186+
elif [[ $INIT == *"upstart"* ]]; then
187+
service dnsmasq start
188+
elif [[ $INIT == *"/sbin/init"* ]]; then
189+
INIT=`/sbin/init --version`
190+
if [[ $INIT == *"systemd"* ]]; then
191+
systemctl enable dnsmasq.service && systemctl start dnsmasq.service
192+
elif [[ $INIT == *"upstart"* ]]; then
193+
service dnsmasq start
194+
fi
195+
fi
196+
}
162197

163198

164199
#welcome
165200
#rootcheck
166201
#dependencies
167202
#backup
203+
#config
168204
download_sources
169205
extract_domains
170206
dnsmasq-conf
171-
finish
207+
finish
208+
#start-deamons

0 commit comments

Comments
 (0)