hblock - the poor man's pi-hole

Reading time: 2 minutes

It’s not the poor man’s pi-hole. A pi-hole can be used for caching and includes a fowarding DNS server. hblock is:

a POSIX-compliant shell script that gets a list of domains that serve ads, tracking scripts and malware from multiple sources and creates a hosts file, among other formats, that prevents your system from connecting to them.

which means that it takes the domains from a deny.list, and the sources from URLs which are specified in a sources.list, removes all domains in an allow.list and writes them into your host file. This process rewrites your hosts file so either back it up or write it into a header file which is prepended to whatever hblock generates from the various sources.

For example: let’s take one of the various options from StevenBlack’s hosts file repo (one of the raw links), create a sources.list file in the /etc/hblock/ directory and paste the link to the file there.

Then run

sudo hblock

and hblock will update/replace your host file. If for whatever reason you need to clean your hist file you can run:

sudo hblock -S none -D none

Why use this intead of an ad-blocker

Because its browser independent. You would’t even need an adblocker (uBlock also allows you to add the same lists, sources and what not, and you can add all the same sources uBlock uses). If you use mutliple browsers this is much more efficient.
Youtube ads in videos won’t get blocked but if you use an alternative front-end you won’t have this issue anyways.

Sources I use

https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
https://raw.githubusercontent.com/4skinSkywalker/Anti-Porn-HOSTS-File/master/HOSTS.txt
https://adaway.org/hosts.txt
https://v.firebog.net/hosts/AdguardDNS.txt
https://v.firebog.net/hosts/Admiral.txt
https://raw.githubusercontent.com/anudeepND/blacklist/master/adservers.txt
https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
https://v.firebog.net/hosts/Easylist.txt
https://v.firebog.net/hosts/Prigent-Adult.txt
# You don't need a single Facebook or "META" service
https://raw.githubusercontent.com/anudeepND/blacklist/master/facebook.txt


⟨ Previous
Alternatives to invasive …
Next ⟩
Major Hackher and the …
Tags
Technology · Privacy · Linux