Host Blocker! A C command line utility.
Go to file
Jacob Windle 708278be7d Merge branch 'feature/delete-host' of jacob.windle/hb into master 2020-01-18 13:13:14 +00:00
.gitignore First commit 2019-02-23 13:08:32 -05:00
CMakeLists.txt Working on linked list data structure for hosts. 2019-12-18 13:46:16 -05:00
Makefile Trying to fix the reading routine 2019-04-17 21:06:55 -04:00 Documentation 2020-01-18 07:38:32 -05:00
linkedlist.c Created a "free_list" method to free up allocated memory. 2020-01-09 09:46:41 -05:00
linkedlist.h Created a "free_list" method to free up allocated memory. 2020-01-09 09:46:41 -05:00
main.c Small change to filemode 2020-01-18 08:12:48 -05:00


The Host Blocker command.

This is a system utility written in C that allows one to quickly black hole hosts in the /etc/hosts file, keeping one from resolving any DNS for those hosts and permanently blocking them on the system.

How it Works

The program "blackholes" hosts by setting their entries in /etc/hosts to be so that when one tries to resolve the host in the browser the host will resolve to

The program will wake up in a configurable timeframe continuously, reading a config file into memory and making appropriate changes to the /etc/hosts based on what it reads from the config.

Starting the program like this allows for the program to run as a daemon:

sudo hb -period <wakeup period> -config <path/to/config> -daemon

The config file at the moment is just a newline separated list of hosts that will be added to the /etc/hosts file.


I would like to get better with C, and will be using C much more in the near future. In addition, I have issues with browsing to sites that hurt my productivity and am always on the command line.


  • Debug logging
  • Systemd unit file for running as a daemon