DNSMasq: ADs block

Script per utilitzar amb dnsmasq per blocar dominis d’anuncis entre d’altres

https://filterlists.com/

#!/bin/bash

#IP in redirigir el trànsit del server blocat.
LISTEN_ADDRESS=192.168.1.1

curl "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=dnsmasq&showintro=0&mimetype=plaintext" | sed "s/127\.0\.0\.1/$LISTEN_ADDRESS/" > /etc/dnsmasq.adblock.conf

curl "http://winhelp2002.mvps.org/hosts.txt" >/tmp/blockaddlist.tmp
for i in `cat /tmp/blockaddlist.tmp | iconv -t UTF-8 | grep "0.0.0.0" | cut -d ' ' -f 2 | cut -d ' ' -f 1 | sed "s/\r//" `; do echo "address=/$i/$LISTEN_ADDRESS" ; done >>/etc/dnsmasq.adblock.conf

curl "http://mirror1.malwaredomains.com/files/BOOT"  > /tmp/blockaddlist.tmp
for i in `cat /tmp/blockaddlist.tmp| grep PRIMARY |cut -d ' ' -f 2`; do echo "address=/$i/$LISTEN_ADDRESS" ; done >>/etc/dnsmasq.adblock.conf

curl "http://repo.nit.cat/domainsblocked/" >/tmp/blockaddlist.tmp
for i in `cat /tmp/blockaddlist.tmp | grep PRIMARY |cut -d ' ' -f 2`; do echo "address=/$i/$LISTEN_ADDRESS" ; done >>/etc/dnsmasq.adblock.conf

curl "https://tgc.cloud/downloads/hosts.txt" >/tmp/blockaddlist.tmp
for i in `cat /tmp/blockaddlist.tmp | grep 0.0.0.0 |cut -d ' ' -f 2` ; do echo "address=/$i/$LISTEN_ADDRESS" ; done >>/etc/dnsmasq.adblock.conf

curl "https://1hos.cf/complete/list.txt" >/tmp/blockaddlist.tmp
for i in `cat /tmp/blockaddlist.tmp` ; do echo "address=/$i/$LISTEN_ADDRESS" ; done >>/etc/dnsmasq.adblock.conf

rm /tmp/blockaddlist.tmp

# Restart DNSmasq
/etc/init.d/dnsmasq reload

Deixa un comentari

L'adreça electrònica no es publicarà. Els camps necessaris estan marcats amb *

one × 3 =