!/bin/sh

prx -- prx@si3t.ch.

Idea from https://sebsauvage.net/wiki/doku.php?id=dns-blocklist

block evil domains. Works for IPv4 and IPv6

Licence: MIT

Script to generate a /etc/hosts file to blacklist ads

Add you entries passing in a file as argument

zerohosts include.txt

CHANGELOG:

1.2 : added more sources,

better include of user submitted file

improved filtering with grep,

removed host last modification time check

remove domain list usage

add -e flag to alert if a list become unavailable

remove echos : call script and redirect to stdout

add description at top of file

1.3 : simplified awk call,

use hardcoded localhost

1.4 : updated lists

set -e

DOWNLOADER (to standard output)

D="wget -O-" # mosts linux

D="curl -L --compressed" # with curl

D="ftp -m -o-" # OpenBSD

VERSION=1.4

DESCR="Generated with zerohosts"

URL="https://si3t.ch/code/zerohosts"

HOSTSSRC="

https://someonewhocares.org/hosts/zero/hosts

https://adaway.org/hosts.txt

https://urlhaus.abuse.ch/downloads/hostfile/

https://winhelp2002.mvps.org/hosts.txt

https://dbl.oisd.nl/basic/

https://gist.githubusercontent.com/Ewpratten/a25ae63a7200c02c850fede2f32453cf/raw/f0778c8ff53345e6dbf8fe2987e70f4a6a8aacd6/hosts-yt-ads

https://hostfiles.frogeye.fr/firstparty-only-trackers-hosts.txt

https://justdomains.github.io/blocklists/lists/easylist-justdomains.txt

https://justdomains.github.io/blocklists/lists/easyprivacy-justdomains.txt

https://justdomains.github.io/blocklists/lists/adguarddns-justdomains.txt

https://justdomains.github.io/blocklists/lists/nocoin-justdomains.txt

https://paulgb.github.io/BarbBlock/blacklists/hosts-file.txt

https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype=plaintext&useip=0.0.0.0

https://raw.githubusercontent.com/AdAway/adaway.github.io/master/hosts.txt

https://raw.githubusercontent.com/FadeMind/hosts.extras/master/UncheckyAds/hosts

https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.2o7Net/hosts

https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Dead/hosts

https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Risk/hosts

https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Spam/hosts

https://raw.githubusercontent.com/PolishFiltersTeam/KADhosts/master/KADhosts.txt

https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts

https://raw.githubusercontent.com/bigdargon/hostsVN/master/option/hosts-VN

https://raw.githubusercontent.com/davidonzo/Threat-Intel/master/lists/latestdomains.piHole.txt

https://raw.githubusercontent.com/mitchellkrogza/Badd-Boyz-Hosts/master/hosts

https://raw.githubusercontent.com/notracking/hosts-blocklists/master/dnscrypt-proxy/dnscrypt-proxy.blacklist.txt

https://raw.githubusercontent.com/shreyasminocha/shady-hosts/main/hosts

https://raw.githubusercontent.com/tiuxo/hosts/master/ads

https://blocklistproject.github.io/Lists/phishing.txt

https://blocklistproject.github.io/Lists/ransomware.txt

https://blocklistproject.github.io/Lists/tracking.txt

https://dl.red.flag.domains/red.flag.domains.txt

"

cat << EOF

zerohost version ${VERSION}

${DESCR}

see ${URL}

$(date '+# %Y-%m-%d %H:%M:%S')

127.0.0.1 localhost

127.0.0.1 localhost.localdomain

127.0.0.1 local

::1 localhost

::1 ip6-localhost

::1 ip6-loopback

255.255.255.255 broadcasthost

ff00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

ff02::3 ip6-allhosts

0.0.0.0 0.0.0.0

:: ::

ENDOFHEADER

EOF

test -f "${1}" && cat "${1}"

download list,

ignore lines with comments

keep lines with actual domain but not local

add redirection to non routable addr

(

for U in ${HOSTSSRC}; do

${D} "${U}" | awk '

/^#/ { next }

$2 ~ /.../ { printf "0.0.0.0 %s\n", $2 }

'

done

) | sort -u

exit 0

Proxy Information
Original URL
gemini://si3t.ch/code/zerohosts/zerohost.sh
Status Code
Success (20)
Meta
application/octet-stream
Capsule Response Time
489.885333 milliseconds
Gemini-to-HTML Time
1.935054 milliseconds

This content has been proxied by September (3851b).