Improve your security and privacy by blocking ads, tracking and malware domains. https://hblock.molinero.dev
  • Shell 87.4%
  • Makefile 5.5%
  • Roff 4.4%
  • M4 2.7%
Find a file
2018-04-04 21:37:53 +02:00
resources Improved version.sh replacements 2018-04-03 23:24:17 +02:00
.gitignore Create temp folder inside project directory 2018-02-11 13:24:09 +01:00
.gitlab-ci.yml Use $HOSTNAME if is defined 2018-02-12 19:46:37 +01:00
firebase.json Firebase migration 2017-07-31 23:31:19 +02:00
hblock Added more sources 2018-04-03 22:13:11 +02:00
LICENSE.md Update license year 2018-02-11 13:25:57 +01:00
Makefile Added install and uninstall targets 2018-04-04 21:37:53 +02:00
package.json 1.2.4 2018-02-12 19:55:57 +01:00
README.md Updated installation instructions 2018-04-03 23:02:01 +02:00

Build Website License


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

Installation

Through NPM:

npm install -g hblock

Manually

curl -o /tmp/hblock 'https://raw.githubusercontent.com/zant95/hblock/v1.2.4/hblock' \
  && echo 'b52c2b493db56f86a89b379973f302ce46bbb162eae25664ea974104f3722bf2  /tmp/hblock' | shasum -c \
  && sudo mv /tmp/hblock /usr/local/bin/hblock \
  && sudo chown root:root /usr/local/bin/hblock \
  && sudo chmod 755 /usr/local/bin/hblock

Note: be sure to regularly update the hosts file for new additions.

Usage

Script arguments

You can also change the default behavior using these options:

Usage: hblock [options...]
 -O, --output FILE            Hosts file location (default: /etc/hosts)
 -R, --redirection IP         Destination IP for all entries in the blocklist
                              (default: 0.0.0.0)
 -H, --header HEADER          Content to be included at the beginning of the
                              hosts file. You can use the output of any other
                              command (e.g. "$(cat header.txt)")
 -S, --sources URLS           Sources to be used to generate the blocklist
                              (whitespace separated URLs)
 -W, --whitelist ENTRIES      Entries to be removed from the blocklist
                              (whitespace separated POSIX BREs)
 -B, --blacklist ENTRIES      Entries to be added to the blocklist
                              (whitespace separated domain names)
 -b, --backup [DIRECTORY]     Make a time-stamped backup in DIRECTORY
                              (default: output file directory)
 -l, --lenient                Match any IP address from sources, although it
                              will be replaced by the destination IP
                              (default: 0.0.0.0, 127.0.0.1 or none)
 -i, --ignore-download-error  Do not abort if a download error occurs
 -v, --version                Show version number and quit
 -h, --help                   Show this help and quit

Preserve content

This script replaces the hosts file of your system, if you want to preserve part of its content, you should wrap that content with the following structure:

# <custom>
...
# </custom>

Run preview

asciicast

Sources

Name Primary Mirror
adaway.org URL URL
AdBlock NoCoin List URL URL
AdGuard - Simplified URL URL
disconnect.me - Ad URL URL
disconnect.me - Malvertising URL URL
disconnect.me - Malware URL URL
disconnect.me - Tracking URL URL
ETH Phishing Detect 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
matomo.org - Spammers URL URL
mitchellkrogza - Badd-Boyz-Hosts URL URL
pgl.yoyo.org URL URL
ransomwaretracker.abuse.ch URL URL
someonewhocares.org URL URL
spam404.com URL URL
StevenBlack URL URL
winhelp2002.mvps.org URL URL
ZeroDot1 - CoinBlockerLists 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.