Chomper - Command Line Tool to Block Websites on Linux

Chomper is an open-source tool used to create a list of websites to be blacklisted or whitelisted during a user's browsing session. Chomper is terminal-driven tool written in Python. This means it is fully operated from the terminal. The motive behind its design is to help people avoid internet distraction and focus on visiting productive websites during work hours and also helps to temporarily block websites on your Linux Desktop. Chomper can also be used as a parental control tool - e.g to limit the sites visited by kids.

How Chomper works

Unlike other blockers which use the Linux hosts file for filtering IP addresses and domain names, Chomper instead filters outgoing requests through a transparent proxy. This makes Chomper ideal for filtering web content at the URL level. What you have to do is just populate the list of what to block and what to whitelist, Chomper will do the rest for you.

Installing Chomper on Linux

The only way to install Chomper at the moment is by building it from source code. One prerequisite for this is the installation of git, make and cmake. Since this setup is done on Ubuntu 16.04, all deps installed are specific to Ubuntu.

$ sudo apt-get install git cmake build-essential curl python-pip

When this is done, proceed to install pyenv. For this, we'll avoid manual installation and use an installer instead.

# curl -L | bash
 % Total % Received % Xferd Average Speed Time Time Time Current
 Dload Upload Total Spent Left Speed
100 2099 100 2099 0 0 2011 0 0:00:01 0:00:01 --:--:-- 2012
Cloning into '/home/jmutai/.pyenv'

Load pyenv automatically by modifying ~/.bash_profile file:

$ vim ~/.bash_profile

Then add:

export PATH="/home/jmutai/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

To load the env manually, source the file in your current session.

$ source ~/.bash_profile
$ pyenv versions
* system (set by /home/jmutai/.pyenv/version)

Clone Chomper from git.

$ git clone
$ cd chomper
$ make init

The make init command will download chomper specific packages and get the environment ready. If you choose to install CPython 3.6, it may take some few minutes to finish setting up. You should then see:

To activate this project's virtualenv, run the following:
$ pipenv shell

Now start shell:

$ pipenv shell
$ mitmdump
# mitmdump
Proxy server listening at http://*:8080

Once the mitmdump begins for the first time, exit it using a key combination -  [ Ctrl+C Ctrl+C ]. A number of certificates files will be generated.

# ls ~/.mitmproxy
mitmproxy-ca-cert.cer mitmproxy-ca-cert.pem mitmproxy-ca.pem
mitmproxy-ca-cert.p12 mitmproxy-ca.p12 mitmproxy-dhparam.pem

You need to import mitmproxy-ca.pem certificate to your browser.

Chrome : Go to Settings > Advanced Settings > Manage Certificates > Authorities. Click Import, select mitmproxy-ca.pem, tick all three boxes, and click OK

Firefox: Go Preferences > Privacy and Security > Certificates > View Certificates > Authorities. Click Import, select mitmproxy-ca.pem, tick all three boxes, and click OK.

How to install and use Chomper internet blocker

The next thing to do is enable IP forwarding.

# vim /etc/sysctl.d/99-sysctl.conf



Save and then run:

# sysctl -p

Using Chomper

Chomper is configured using YAML syntax files with three levels.

  • The first level defines the names of the rules.
  • The second level defines whether a rule is a blacklist or whitelist.
  • The third level defines the addresses involved in a rule.

Below is a simple configuration file with few blacklists and whitelists

$ cat data/rules.yaml
 - block_type:
     - whitelist
 - addresses:

 - block_type:
     - blacklist
 - addresses:

When running chomper application located under bin directory, two arguments are required.

  • The rule name
  • The block time in minutes

For example to run work_block rule for 20 minutes. I'll execute

# cd bin
# ./chomper work_block 20
New block in effect until 2018-02-20 23:34:08.

This rules blocks specified websites. Try accessing any of the listed sites. You should get a banner message saying "Website has been blocked by Chomper!".

How to install and use Chomper internet blocker


We have covered all the key things you need to start using Chomper. This tool look interesting. It is still fresh but under active development. The current version only work for Linux systems but the Developer is aiming at delivering version for MacOS and GUI for it. Enjoy using Chomper.

Josphat Mutai 9:32 pm

About Josphat Mutai

Red Hat Certified Engineer with more than 2 years experience managing critical Cloud Infrastructures and Services. Passionate about Technology and loves testing and reviewing gadgets and Open-source tools.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.