› Foros › PC › Software libre
#!/bin/bash
host=$(mktemp)
wget --quiet --no-cache --no-cookies --max-redirect=0 --timeout=10 --no-check-certificate -O- https://raw.githubusercontent.com/easylist/easylist/master/easylist/easylist_adservers.txt | awk "BEGIN{FS=\"[|^]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+\^("\\\$third-party")?$/{print \"0.0.0.0 \" tolower(\$3)}" > $host
wget --quiet --no-cache --no-cookies --max-redirect=0 --timeout=10 --no-check-certificate -O- https://raw.githubusercontent.com/easylist/easylist/master/easylist/easylist_adservers_popup.txt | awk "BEGIN{FS=\"[|^]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+\^("\\\$popup,third-party")?$/{print \"0.0.0.0 \" tolower(\$3)}" >> $host
wget --quiet --no-cache --no-cookies --max-redirect=0 --timeout=10 --no-check-certificate -O- https://raw.githubusercontent.com/easylist/easylist/master/easylist/easylist_adservers_popup.txt | awk "BEGIN{FS=\"[|^]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+\^("\\\$popup")?$/{print \"0.0.0.0 \" tolower(\$3)}" >> $host
wget --quiet --no-cache --no-cookies --max-redirect=0 --timeout=10 --no-check-certificate -O- https://raw.githubusercontent.com/easylist/easylist/master/easylist_adult/adult_adservers.txt | awk "BEGIN{FS=\"[|^]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+\^("\\\$third-party")?$/{print \"0.0.0.0 \" tolower(\$3)}" >> $host
wget --quiet --no-cache --no-cookies --max-redirect=0 --timeout=10 --no-check-certificate -O- https://raw.githubusercontent.com/easylist/easylist/master/easylist_adult/adult_adservers_popup.txt | awk "BEGIN{FS=\"[|^]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+\^("\\\$popup,third-party")?$/{print \"0.0.0.0 \" tolower(\$3)}" >> $host
wget --quiet --no-cache --no-cookies --max-redirect=0 --timeout=10 --no-check-certificate -O- https://raw.githubusercontent.com/easylist/easylist/master/easylist_adult/adult_adservers_popup.txt | awk "BEGIN{FS=\"[|^]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+\^("\\\$popup")?$/{print \"0.0.0.0 \" tolower(\$3)}" >> $host
wget --quiet --no-cache --no-cookies --max-redirect=0 --timeout=10 --no-check-certificate -O- https://raw.githubusercontent.com/easylist/easylist/master/easyprivacy/easyprivacy_trackingservers.txt | awk "BEGIN{FS=\"[|^]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+\^("\\\$third-party")?$/{print \"0.0.0.0 \" tolower(\$3)}" >> $host
wget --quiet --no-cache --no-cookies --max-redirect=0 --timeout=10 --no-check-certificate -O- https://raw.githubusercontent.com/easylist/easylist/master/easyprivacy/easyprivacy_trackingservers_international.txt | awk "BEGIN{FS=\"[|^]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+\^("\\\$third-party")?$/{print \"0.0.0.0 \" tolower(\$3)}" >> $host
wget --quiet --no-cache --no-cookies --max-redirect=0 --timeout=10 --no-check-certificate -O- https://adaway.org/hosts.txt | awk "\$0~/^127\.0\.0\.1[[:space:]]+([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print \"0.0.0.0 \" tolower(\$2)}" >> $host
wget --quiet --no-cache --no-cookies --max-redirect=0 --timeout=10 --no-check-certificate -O- http://www.malwaredomainlist.com/hostslist/hosts.txt | awk "\$0~/^127\.0\.0\.1[[:space:]]+([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print \"0.0.0.0 \" tolower(\$2)}" >> $host
wget --quiet --no-cache --no-cookies --max-redirect=0 --timeout=10 --no-check-certificate -O- "https://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml&showintro=0&mimetype=plaintext" | awk "\$0~/^([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print \"0.0.0.0 \" tolower(\$1)}" >> $host
echo "127.0.0.1 localhost" > /etc/hosts
sort $host | awk '!a[$0]++' >> /etc/hosts