Chomper is a free and open source Python cli for Linux desktop. It lets you block access to distracting websites for specified periods of time. The program is intended to help you with issues being productive on a desktop due to Internet distractions. One can set a period to block websites. Until that timer expires, you will be unable to access sites.
apt command/apt-get command:
$ sudo apt install python3-pip -y
$ pip3 install --user pipenv
Clone the repo:
$ git clone https://github.com/aniketpanjwani/chomper.git
Type the following commands:
$ cd chomper
$ make init
To activate this project’s virtualenv, run the following:
$ pipenv shell
mitmproxy is an interactive console program that allows traffic flows to be intercepted, inspected, modified and replayed. Type the following command to start proxy server:
Proxy server listening at http://*:8080
You need to exit mitmdump by pressing Ctrl-C. There should now be various certificate files in ~/.mitmproxy
$ ls -l ~/.mitmproxy
total 24 -rw-rw-r-- 1 vivek vivek 1318 Feb 20 11:30 mitmproxy-ca-cert.cer -rw-rw-r-- 1 vivek vivek 1140 Feb 20 11:30 mitmproxy-ca-cert.p12 -rw-rw-r-- 1 vivek vivek 1318 Feb 20 11:30 mitmproxy-ca-cert.pem -rw-rw-r-- 1 vivek vivek 2529 Feb 20 11:30 mitmproxy-ca.p12 -rw-rw-r-- 1 vivek vivek 3022 Feb 20 11:30 mitmproxy-ca.pem -rw-rw-r-- 1 vivek vivek 770 Feb 20 11:30 mitmproxy-dhparam.pem
Next import these certificates to your web browser:
Go to Settings > Advanced Settings > Manage Certificates > Authorities. Click import, select mitmproxy-ca.pem, tick all three boxes, and click OK.
Go Preferences > Privacy and Security > Certificates > View Certificates > Authorities. Click import, select mitmproxy-ca.pem, tick all three boxes, and click OK.
Enable IPv4/IPv6 traffic forwarding
Edit /etc/sysctl.d/99-sysctl.conf file:
$ sudo vi /etc/sysctl.d/99-sysctl.conf
Make sure following entries are set/uncommented:
Reload the sysctl changes using the following command:
$ sudo sysctl -p
How to use Chomper
Simply use config file as follows:
$ cat ~/chomper/data/rules.yaml
coding: - block_type: - whitelist - addresses: - github.com/coleifer/peewee - stackoverflow.com - unix.stackexchange.com - aws.amazon.com - upwork.com - doc.peewee-orm.com - pandas.pydata.org - python.org - amazonaws.com - amazon.com/ap/signin - cloudfront.net email: - block_type: - whitelist - addresses: - mail.google.com allon: - block_type: - blacklist - addresses: - cyberciti.biz alloff: - block_type: - whitelist - addresses: - cyberciti.biz
Customize file as per your needs.
How to run script
Run it as follows to allow coding sites for 30 minutes and block everything else:
$ ~/chomper/bin/chomper coding 30
Chomper is an Internet blocker for Linux desktop works, but it is not very user-friendly for new users. If you are a sysadmin or developer, it should be easy to set up. I am looking forward to seeing a GUI option for the Chomper. For more info see the official project github repo here.