Skip to content

ukiran03/ghosts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interactive Tool to Deal with /etc/hosts

Premise

I block all unwanted sites, including fake news, gambling, porn, and social media sites, which are sourced from StevenBlack/hosts. However, occasionally, I need to access a website that has been blocked. To do this, I manually mv the /etc/hosts/ file, access the sites, and then move it back. To simplify this process, I wrote this tool.

How It Works

  • There are two files:
    1. A default file containing static data that doesn’t change.
    2. A “social” file that contains data which might change (i.e., sites that are temporarily allowed or blocked).
  • The tool tracks which sites are blocked and which are allowed based on user input and the config file. After the process is complete, the data from both files are combined and appended to the destination file etc/hosts.

Things to Do

  • Add a list subcommand with flags:
    1. --all (boolean): If true, print both added and deleted sites separately. By default, only deleted sites are shown.
  • Use errors.Is to detect and handle permission denied errors more effectively.

About

Edit /etc/hosts interactively with ease

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages