Hosts: Block the bullshit web
Advertisements, tracking scripts and other countless lines of code downloaded on to your machine to spam and monitor you whenever you connect to the internet.
Host is a project to block advertisements, tracking scripts and other websites including pornographic content using this host file.
I also have integrated a feature to toggle the Host file on/off as per the need. Currently, this approach is available for Windows operating system.
How to setup
Download the ‘hosts’ file and replace the hosts file in C:\Windows\System32\drivers\etc
Alternatively, you can download the desired version from Mr Steven Black's GitHub repository and download the required hosts file (Preferable -> Unified hosts + fake news + gambling + porn + social).
If you download from above Steven Black’s repository, then append the new hosts file content (modify as require) to existing hosts file at C:\Windows\System32\drivers\etc
Win + R -> regedit -> HKEY_CLASSES_ROOT\batfile\shell
Double click (Default) and change the value to runas
Win + R -> regedit -> Enter
Navigate to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache
Double click Start and change the value to 4
Win + R -> services.msc
Search = DNS Client -> properties and verify Start type = Disabled and all other buttons are disabled
How to use
We might often have to turn the hosts file on and off, for various reasons. Doing this by navigating all the way to C:\Windows\System32\drivers\etc and making necessary changes will be a pain. So in this section we will create shortcut to toggle the hosts file whenever required. There are two methods for this, follow whichever suits you.
Download hosts[dot]bat file and save it in C:\Windows\System32
Win + R -> hosts -> Enter -> Yes -> hosts file will be disabled/enabled
Download hosts[dot]bat file and save it at your desired location
Click the Start button
Start typing Command Prompt in the search box
Right-click Command Prompt once it appears in the search results, and select Pin to Taskbar
While holding SHIFT, right-click the black Command Prompt icon in the taskbar
Select Properties from the context menu that appeared
Add following to Target field: %windir%\system32\cmd.exe /c “drive\desired path\hosts.bat”
Go to General tab and change the name to Toggle Hosts and add a fancy icon if you want
Access with shortcut -> Win + pinned location -> Enter -> Yes -> hosts file will be disabled/enabled