воскресенье, 1 декабря 2019 г.

block ip's

#!/bin/bash
# download blacklists
# https://talosintelligence.com/documents/ip-blacklist
printf "# file01\n" > blacklist.list.raw
curl -s https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | egrep -v '^#|^$' >> blacklist.list.raw
printf "# file02\n" >> blacklist.list.raw
curl -s https://mirror1.malwaredomains.com/files/justdomains  | egrep -v '^#|^$' | sed 's/^/0.0.0.0 /g' >> blacklist.list.raw
printf "# file03\n" >> blacklist.list.raw
curl -s http://sysctl.org/cameleon/hosts  | egrep -v '^#|^$'  >> blacklist.list.raw
printf "# file04\n" >> blacklist.list.raw
curl -s "https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist" | egrep -v '^#|^$' | sed 's/^/0.0.0.0 /g' >> blacklist.list.raw
printf "# file05\n" >> blacklist.list.raw
curl -s https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt | egrep -v '^#|^$'  | sed 's/^/0.0.0.0 /g' >> blacklist.list.raw
printf "# file06\n" >> blacklist.list.raw
curl -s https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt  | egrep -v '^#|^$' | sed 's/^/0.0.0.0 /g' >> blacklist.list.raw
printf "# file07\n" >> blacklist.list.raw
curl -s https://hosts-file.net/ad_servers.txt  | egrep -v '^#|^$' >> blacklist.list.raw
printf "# file08\n" >> blacklist.list.raw
curl -s https://raw.githubusercontent.com/zapret-info/z-i/master/nxdomain.txt  | egrep -v '^#|^$' | sed 's/^/0.0.0.0 /g' >> blacklist.list.raw
printf "# file09\n" >> blacklist.list.raw
curl -s https://raw.githubusercontent.com/HenningVanRaumle/pihole-ytadblock/master/ytadblock.txt | egrep -v '^#|^$'  >> blacklist.list.raw
printf "$ file10\n" >> blacklist.list.raw
curl -s https://raw.githubusercontent.com/notracking/hosts-blocklists/master/hostnames.txt | egrep -v '^#|^$' >> blacklist.list.raw
#
# replace 127.0.0.1 with 0.0.0.0 for faster TCP response on systems where http(s) socket is listening locally
sed 's/127.0.0.1/0.0.0.0/g' blacklist.list.raw > blacklist.list
rm blacklist.list.raw
#
# only keep unique entries
mv blacklist.list blacklist.list.dupl
sort -u blacklist.list.dupl > blacklist.list
rm blacklist.list.dupl
#
# remove whitelisted domains from the blacklist
/etc/dnsmasq.d/whitelist.fix.sh
#
# completed
exit 0

Комментариев нет:

Отправить комментарий

Примечание. Отправлять комментарии могут только участники этого блога.