Created
May 15, 2019 01:50
-
-
Save le0park/c20eb8bb82950c2592fb478ebf5a7787 to your computer and use it in GitHub Desktop.
Block ip with text list file in ubuntu
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
| while IFS='' read -r line || [[ -n "$line" ]]; do | |
| echo "Blocking IP: $line..." | |
| iptables -A INPUT -s $line -j DROP || { echo 'Blocking failed.' ; exit 1; } | |
| done < "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment