Last active
July 1, 2018 21:54
-
-
Save subfission/19167b77b115ea5185027b077be8784b to your computer and use it in GitHub Desktop.
Linux/MacOS bash completion for host domain banning
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
| # Ban domain with hosts entry. usage: hostban target_domain | |
| hostban() { | |
| ( "$#" -ne 1 ) && (echo "ERROR: Missing host to ban!"; echo "usage: hostban target_domain"; exit 1) | |
| [ "$(whoami)" != "root" ] && (return $(sudo ban_host "$1")) | |
| echo "0.0.0.0 $1" >> /etc/hosts | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment