Skip to content

Lmpkessels/blocker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blocker

License: MIT Built with Rust Status: In Progress

Blocker is a simple, lightweight CLI website blocker written in Rust for Linux.
It modifies /etc/hosts to block distracting domains for a chosen amount of time, helping you stay focused.

Features

  • Add/remove domains from /etc/hosts
  • List currently blocked domains
  • Temporarily block all added domains for a set duration (e.g. 30min, 2h)
  • Protected unblocking with a passphrase (prevents impulse decisions during focus sessions)

Installation

  1. Install Rust (if not installed):
    https://www.rust-lang.org/tools/install

  2. Clone and build:

    git clone https://github.com/Lmpksels/blocker.git
    cd blocker
    cargo build --release
  3. Copy the binary

    sudo cp -f target/release/blocker /usr/local/bin/blocker

Usage

# Add a domain
sudo blocker add example.com
# Remove a domain
sudo blocker remove example.com
# List blocked domains
blocker list
# Temporary block
# Minutes
sudo blocker block 30 min
# Hours
sudo blocker block 2h
# Unblock (10000 keystroke passphrase)
sudo blocker unblock
# Run as systemd service (recommended)
#1 access blocker.service
sudo nano /etc/systemd/system/blocker.service
#2 paste the following text into blocker.service
[Unit]
Description=Blocker Daemon
After=network.target

[Service]
ExecStart=/usr/local/bin/blocker daemon
Restart=always
User=root
WorkingDirectory=/root

[Install]
WantedBy=multi-user.target
#3 Reload system and enable service
sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable blocker
#4 Start the service
sudo systemctl start blocker
sudo systemctl status blocker

Future features

Making sure this runs after rebooting the system and killing the running process becomes harder for the given amount of time.

Contribution

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

Licensed under MIT License.
© 2026 Luuk Kessels

Contact

About

A CLI website blocker written in Rust for Linux-OS to block out domains for a given amount of time and remain focused

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages