#website #host #redirect #url #command-line-tool #blocker

app host-rs

This is a CLI tool to manage website blocking, unblocking, redirection

5 releases

0.2.3 Oct 23, 2024
0.2.2 Oct 15, 2024
0.2.0 Sep 26, 2024
0.1.2 Jun 21, 2024

#169 in Command line utilities

Download history 15/week @ 2024-09-16 163/week @ 2024-09-23 20/week @ 2024-09-30 148/week @ 2024-10-07 218/week @ 2024-10-14 126/week @ 2024-10-21 6/week @ 2024-10-28 23/week @ 2024-11-04

514 downloads per month

Custom license

27KB
547 lines

Host-RS

Blazingly fast CLI tool written in Rust to manage website blocking, unblocking, redirection.

Features

  • Block Website: Add websites to blocklist to prevent access.
  • Unblock Website: Remove websites from the blocklist to allow access.
  • Redirect Website: Redirect traffic from one website to another.
  • Add Host Sources: Add host source (A url that contains a list of hostnames).
  • Update Host Sources: Update host sources.
  • Import hosts: Import hostnames stored in a file and block or unblock them.
  • Export hosts: Export the list of currently blocked or unblocked hosts.

Installation

Ensure you have Rust installed (If you dont want to install Rust, install from precompiled binary).

Linux & macOS

git clone https://github.com/BiswajitThakur/host-rs.git
cd host-rs/
./install.sh

Other

cargo install host-rs

Usage

  • Help
> host-rs --help
This is a CLI tool to manage website blocking, unblocking, redirection.

Usage: host-rs [OPTIONS] [COMMAND]

Commands:
  insert  Add host or url to allow, block, redirect, sources list
  remove  Remove allow, block, redirect host and host sources
  print   Print allow, block, redirect, etc host and host sources
  import  Import host or url from file
  export  Expoer user data (you can import it later)
  update  Update sources or self
  help    Print this message or the help of the given subcommand(s)

Options:
      --allow <ALLOW>...        Add host to allow list & removed from block list
      --block <BLOCK>...        Add to block list & remove from allow list
      --redirect <REDIRECT>...  Add to redirect list & remove from allow and block
      --restore                 delete all host, host sources and restore /etc/hosts file
  -h, --help                    Print help
  -V, --version                 Print version
  • Block Website
host-rs --block <url or hostname1> <url or hostname2> ...
  • Remove Website from Blocklist
host-rs rm --block <url or hostname1> <url or hostname2> ...
# or
# host-rs remove --block <url or hostname1> <url or hostname2> ...
  • Allow Website

use this when, you added hostsources and if it block some website and you don't want to block it.

host-rs --allow <url or hostname1> <url or hostname2> ...
  • Remove Website from Allow List
host-rs rm --allow <url or hostname1> <url or hostname2> ...
  • Redirection

In the following example, <url or hostname2> redirected to <url or hostname1> and <url or hostname4> redirected to <url or hostname3>

host-rs --redirect <url or hostname1> <url or hostname2> <url or hostname3> <url or hostname4> ...
  • Remove from Redirect
host-rs rm --redirect <url or hostname2> <url or hostname4> ...
  • Add Host Sources

You will get verious sources from this repo.

host-rs insert --sources <url of sources>
  • Update Host Sources
host-rs update --sources
  • Remove Host Sources
host-rs remove --sources <url of sources>
  • Uninstall
host-rs remove --self

Contributing

Contributions are welcome! If you find any bugs, want to request a new feature or improve the code feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Dependencies

~9–25MB
~383K SLoC