Last active
March 7, 2020 04:52
-
-
Save hoangdh/c294250487d440864f872a252d1c036d to your computer and use it in GitHub Desktop.
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 | |
if [ -n "$1" ] | |
then | |
sudo iptables -I INPUT -s $1 -j DROP -m comment --comment "Block. Reason: $2" | |
echo "This IP ($1) has been blocked by $2" | |
else | |
echo -e "Usage: ./$0 <ip> <reason>\nExample: ./$0 1.2.3.4 \"Bruteforce site abc.com\"" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment