- Shell 87.4%
- Makefile 5.5%
- Roff 4.4%
- M4 2.7%
| resources | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| firebase.json | ||
| hblock | ||
| LICENSE.md | ||
| Makefile | ||
| README.md | ||
hBlock
Improve your security and privacy by blocking ads, tracking and malware domains.
Table of contents
What is this for?
This POSIX-compliant shell script, designed for Unix-like systems, gets a list of domains that serve ads, tracking scripts and malware from multiple reputable sources and creates a hosts file that prevents your system from connecting to them.
Is it safe to use?
Absolutely, this script selects only the domain names for each source, so if a domain name is redirected to a rogue server your system will not be affected. In the worst scenario you can lose access to a legitimate domain name due a false positive, but you can reverse it by adding that domain to the whitelist.
Nightly builds
I provide nightly builds of the hosts file and installers for Windows (batch file installer) and Android (flashable zip).
| URL |
|---|
| https://hblock.molinero.xyz |
Usage
Run without installation
curl 'https://raw.githubusercontent.com/zant95/hblock/master/hblock' -o /tmp/hblock && \
echo 'baf7ebdf300d75fd376cdb25e72f8c64d1a712962f47de43e1f8eeaec7ea4d7a /tmp/hblock' | shasum -c && \
sh /tmp/hblock
Installation
curl 'https://raw.githubusercontent.com/zant95/hblock/master/hblock' -o /tmp/hblock && \
echo 'baf7ebdf300d75fd376cdb25e72f8c64d1a712962f47de43e1f8eeaec7ea4d7a /tmp/hblock' | shasum -c && \
sudo mv /tmp/hblock /usr/local/bin/hblock && sudo chmod a+rx /usr/local/bin/hblock
Note: be sure to regularly update the hosts file for new additions or download the script and create a scheduled task.
Script arguments
You can also change the default behavior using these options:
Usage: hblock [options...]
-O, --output FILE Output file (default: /etc/hosts)
-R, --redirection IP Domain redirection IP (default: 0.0.0.0)
-H, --header STRING File header (default: see source code)
-S, --sources STRING Space separated URLs (default: see source code)
-W, --whitelist STRING Space separated entries, POSIX basic regex (default: see source code)
-B, --blacklist STRING Space separated entries (default: see source code)
-b, --backup Make a time-stamped backup (default: disabled)
-l, --lenient Select any IP address from sources (default: 0.0.0.0, 127.0.0.1 or none)
-i, --ignore-download-error Do not abort on download error (default: disabled)
-h, --help Print this help
Run preview
Sources
| Name | Primary | Mirror |
|---|---|---|
| adaway.org | URL | URL |
| disconnect.me - Ad | URL | URL |
| disconnect.me - Malvertising | URL | URL |
| disconnect.me - Malware | URL | URL |
| disconnect.me - Tracking | URL | URL |
| FadeMind - add.2o7Net | URL | URL |
| FadeMind - add.Dead | URL | URL |
| FadeMind - add.Risk | URL | URL |
| FadeMind - add.Spam | URL | URL |
| KADhosts | URL | URL |
| malwaredomainlist.com | URL | URL |
| malwaredomains.com - Immortal domains | URL | URL |
| malwaredomains.com - Just domains | URL | URL |
| pgl.yoyo.org | URL | URL |
| ransomwaretracker.abuse.ch | URL | URL |
| someonewhocares.org | URL | URL |
| spam404.com | URL | URL |
| winhelp2002.mvps.org | URL | URL |
| zeustracker.abuse.ch | URL | URL |
Disclaimer
This script, by default, replaces the /etc/hosts file of your system. I am not responsible for any damage or loss, always make backups.
License
See the license file.
