Skip to content

Instantly share code, notes, and snippets.

@le0park
Created May 15, 2019 01:50
Show Gist options
  • Save le0park/c20eb8bb82950c2592fb478ebf5a7787 to your computer and use it in GitHub Desktop.
Save le0park/c20eb8bb82950c2592fb478ebf5a7787 to your computer and use it in GitHub Desktop.
Block ip with text list file in ubuntu
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