...
|
...
|
@@ -17,6 +17,33 @@
|
17
|
17
|
#"https://github.com/yous/YousList/raw/master/hosts.txt"
|
18
|
18
|
#)
|
19
|
19
|
|
|
20
|
+#array=("https://adaway.org/hosts.txt"
|
|
21
|
+#"https://kawi.fr/android-hosts.txt"
|
|
22
|
+#"http://winhelp2002.mvps.org/hosts.txt"
|
|
23
|
+#"https://hosts-file.net/ad_servers.txt"
|
|
24
|
+#"https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext"
|
|
25
|
+#"http://sysctl.org/cameleon/hosts"
|
|
26
|
+#"http://rlwpx.free.fr/WPFF/hosts.htm"
|
|
27
|
+#"http://www.malwaredomainlist.com/hostslist/hosts.txt"
|
|
28
|
+#"https://sites.google.com/site/logroid/files/hosts.txt?attredirects=0"
|
|
29
|
+#"https://github.com/yous/YousList/raw/master/hosts.txt"
|
|
30
|
+#"https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-blocklist.txt"
|
|
31
|
+#"https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-malware.txt"
|
|
32
|
+#"https://zerodot1.gitlab.io/CoinBlockerLists/list.txt"
|
|
33
|
+#"https://zerodot1.gitlab.io/CoinBlockerLists/list_browser.txt"
|
|
34
|
+#"https://raw.githubusercontent.com/mitchellkrogza/Badd-Boyz-Hosts/master/hosts"
|
|
35
|
+#"https://raw.githubusercontent.com/r-a-y/mobile-hosts/master/AdguardMobileAds.txt"
|
|
36
|
+#"https://raw.githubusercontent.com/r-a-y/mobile-hosts/master/AdguardMobileSpyware.txt"
|
|
37
|
+#"https://raw.githubusercontent.com/EnergizedProtection/block/master/ultimate/formats/hosts.txt"
|
|
38
|
+#"https://raw.githubusercontent.com/mitchellkrogza/The-Big-List-of-Hacked-Malware-Web-Sites/master/hacked-domains.list"
|
|
39
|
+#"https://someonewhocares.org/hosts/zero/hosts"
|
|
40
|
+#"https://www.malwaredomainlist.com/hostslist/hosts.txt"
|
|
41
|
+#"https://mirror.cedia.org.ec/malwaredomains/justdomains"
|
|
42
|
+#"https://mirror.cedia.org.ec/malwaredomains/immortal_domains.txt"
|
|
43
|
+#"https://ransomwaretracker.abuse.ch/downloads/RW_DOMBL.txt"
|
|
44
|
+#"https://zeustracker.abuse.ch/blocklist.php?download=baddomains"
|
|
45
|
+#)
|
|
46
|
+
|
20
|
47
|
array=("https://adaway.org/hosts.txt"
|
21
|
48
|
"https://kawi.fr/android-hosts.txt"
|
22
|
49
|
"http://winhelp2002.mvps.org/hosts.txt"
|
...
|
...
|
@@ -27,6 +54,17 @@ array=("https://adaway.org/hosts.txt"
|
27
|
54
|
"http://www.malwaredomainlist.com/hostslist/hosts.txt"
|
28
|
55
|
"https://sites.google.com/site/logroid/files/hosts.txt?attredirects=0"
|
29
|
56
|
"https://github.com/yous/YousList/raw/master/hosts.txt"
|
|
57
|
+"https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-blocklist.txt"
|
|
58
|
+"https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-malware.txt"
|
|
59
|
+"https://raw.githubusercontent.com/r-a-y/mobile-hosts/master/AdguardMobileAds.txt"
|
|
60
|
+"https://raw.githubusercontent.com/r-a-y/mobile-hosts/master/AdguardMobileSpyware.txt"
|
|
61
|
+"https://mirror.cedia.org.ec/malwaredomains/justdomains"
|
|
62
|
+"https://mirror.cedia.org.ec/malwaredomains/immortal_domains.txt"
|
|
63
|
+"https://kawi.fr/auto-hosts.txt"
|
|
64
|
+"https://kawi.fr/eulerian-domain.hosts"
|
|
65
|
+"https://kawi.fr/criteo-domain.hosts"
|
|
66
|
+"https://hostfiles.frogeye.fr/firstparty-trackers-hosts.txt"
|
|
67
|
+"https://raw.githubusercontent.com/x0uid/SpotifyAdBlock/master/hosts"
|
30
|
68
|
)
|
31
|
69
|
|
32
|
70
|
REDIRECTION="127.0.0.1"
|
...
|
...
|
@@ -35,6 +73,10 @@ WGET="wget -q"
|
35
|
73
|
TEMPHTML="/tmp/host.txt"
|
36
|
74
|
TEMPHTML2="/tmp/host2.txt"
|
37
|
75
|
OUTPUT="/var/www/html/completehosts-uniq.txt"
|
|
76
|
+OUTPUTOLD="/var/www/html/completehosts-uniq.old.txt"
|
|
77
|
+CLEAN_OUTPUT="/tmp/cleanhosts.txt"
|
|
78
|
+CLEAN_OUTPUTOLD="/tmp/cleanhostsold.txt"
|
|
79
|
+LOG="/tmp/hostsmod.log"
|
38
|
80
|
|
39
|
81
|
function clean_temp_files()
|
40
|
82
|
{
|
...
|
...
|
@@ -44,11 +86,16 @@ function clean_temp_files()
|
44
|
86
|
|
45
|
87
|
trap clean_temp_files EXIT
|
46
|
88
|
|
47
|
|
-rm -f $TEMPHTML $TEMPHTML2
|
|
89
|
+if [ -e $OUTPUT ]
|
|
90
|
+then
|
|
91
|
+ mv $OUTPUT $OUTPUTOLD
|
|
92
|
+fi
|
|
93
|
+
|
|
94
|
+rm -f $TEMPHTML $TEMPHTML2 $CLEAN_OUTPUT $CLEAN_OUTPUTOLD $LOG
|
48
|
95
|
cpt=0
|
49
|
96
|
for link in ${array[@]}
|
50
|
97
|
do
|
51
|
|
- echo "+- Source [$link]"
|
|
98
|
+ echo "+- Source [$link]" >> $LOG
|
52
|
99
|
$WGET $link -O $TEMPHTML
|
53
|
100
|
dos2unix $TEMPHTML &> /dev/null
|
54
|
101
|
cat $TEMPHTML >> $TEMPHTML2
|
...
|
...
|
@@ -57,20 +104,18 @@ do
|
57
|
104
|
cpt=$(( $cpt + 1 ))
|
58
|
105
|
done
|
59
|
106
|
|
60
|
|
-echo "+- Cleaning"
|
61
|
107
|
grep -v -e '^#' -e '^$' $TEMPHTML2|sort -u|iconv -t ASCII//TRANSLIT -f UTF-8 > $TEMPHTML
|
62
|
108
|
rm -f $TEMPHTML2
|
63
|
109
|
|
64
|
110
|
NUM=$(cat $TEMPHTML |wc -l)
|
65
|
|
-echo "+- # Domains Before $NUM"
|
66
|
111
|
|
67
|
|
-echo "+- Extracting domains"
|
|
112
|
+#echo "+- Extracting domains"
|
68
|
113
|
awk '{print $2}' $TEMPHTML > $TEMPHTML2
|
69
|
114
|
|
70
|
|
-echo "+- Removing Dup"
|
|
115
|
+#echo "+- Removing Dup"
|
71
|
116
|
cat $TEMPHTML2 |sort -u |uniq > $TEMPHTML
|
72
|
117
|
awk '{print redir " " $1}' redir=$REDIRECTION $TEMPHTML | grep -v -e "^127.0.0.1 0.0.0.0$" -e "^127.0.0.1 $" > $TEMPHTML2
|
73
|
|
-cat $TEMPHTML2 | sort -u | uniq > $TEMPHTML
|
|
118
|
+cat $TEMPHTML2 | grep -v coinhive | sort -u | uniq > $TEMPHTML
|
74
|
119
|
|
75
|
120
|
|
76
|
121
|
echo "#hostfile created $(date) by merging and deduplicating :" > $OUTPUT
|
...
|
...
|
@@ -78,6 +123,24 @@ for link in ${array[@]}
|
78
|
123
|
do
|
79
|
124
|
echo "# - $link" >> $OUTPUT
|
80
|
125
|
done
|
|
126
|
+grep -v -e xx.fbcdn.net -e '127.0.0.1 akamaihd.net' -e 'lh3.googleusercontent.com' $TEMPHTML > $TEMPHTML2
|
|
127
|
+
|
|
128
|
+mv $TEMPHTML2 $TEMPHTML
|
81
|
129
|
cat $TEMPHTML >> $OUTPUT
|
82
|
|
-NUM=$(cat $TEMPHTML |wc -l)
|
83
|
|
-echo "+- # Domains $NUM"
|
|
130
|
+NUMAFTER=$(cat $TEMPHTML |wc -l)
|
|
131
|
+
|
|
132
|
+grep -v "hostfile created" $OUTPUT | grep -v '127.0.0.1 akamaihd.net' > $CLEAN_OUTPUT
|
|
133
|
+grep -v "hostfile created" $OUTPUTOLD > $CLEAN_OUTPUTOLD
|
|
134
|
+MD5NEW=$(md5sum $CLEAN_OUTPUT |awk '{print $1}')
|
|
135
|
+MD5OLD=$(md5sum $CLEAN_OUTPUTOLD |awk '{print $1}')
|
|
136
|
+
|
|
137
|
+if [ $MD5NEW != $MD5OLD ]
|
|
138
|
+then
|
|
139
|
+ cat $LOG
|
|
140
|
+ echo "+- # Domains Before Deduplicating $NUM"
|
|
141
|
+ echo "+- # Domains After Deduplicating $NUMAFTER"
|
|
142
|
+ NUMUNIQOLD=$(cat $CLEAN_OUTPUTOLD|grep "^127"|wc -l)
|
|
143
|
+ NUMUNIQ=$(cat $CLEAN_OUTPUT|grep "^127"|wc -l)
|
|
144
|
+ echo "+- # $(( $NUMUNIQ - $NUMUNIQOLD )) New Additions"
|
|
145
|
+ diff $CLEAN_OUTPUTOLD $CLEAN_OUTPUT |grep '^>'
|
|
146
|
+fi
|