Last active
June 27, 2019 21:31
-
-
Save Jacajack/9fd6796e53c39ccf114f75924c7cfbeb to your computer and use it in GitHub Desktop.
/etc/hosts patch generator (based on StevenBlack repo)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BLOCK="gambling porn fakenews social" | |
EXCEPT="" | |
cp hosts hosts.new | |
# Base | |
echo "blocking adware + malware..." | |
curl -s "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" | sed -ne '/# Start StevenBlack/,$p' >> hosts.new | |
# More | |
for v in $BLOCK; do | |
echo "blocking $v..." | |
curl -s "https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/$v/hosts" | sed -ne '/# Start StevenBlack/,$p' >> hosts.new | |
done; | |
# Exceptions | |
for v in $EXCEPT; do | |
echo "adding exception - $v..." | |
grep -v "$v" hosts.new | sponge hosts.new | |
done; | |
diff -u hosts hosts.new > hosts.patch | |
echo "use hosts.patch" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment