October 31, 2018
Block Malware and Tracking Sites
Instead of using a personal firewall or other host-based detection system to filter unwanted traffic (tracking sites, malware, etc.), use the good old “/etc/hosts/” file to create a natural filter.
Use Steven Black hosts file to get a list of FQDNs to block.
Instead of directing traffic to 0.0.0.0, redirect it to an IP you own with a web server that will respond with an empty page. I found that this speeds things up by not leaving the browser hanging trying to connect to a server that doesn’t exist. In my example, I use 37.221.199.150 as the catch-all.
curl -O https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
sed -i '' -e 's/0\.0\.0\.0 0\.0\.0\.0//g' hosts
sed -i '' -e 's/0\.0\.0\.0/37.221.199.150/g' hosts
sudo cp hosts /etc/hosts
rm hosts