Skip to content

Instantly share code, notes, and snippets.

@josuecau
Created July 11, 2014 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josuecau/44c3d4485bac5ea83d35 to your computer and use it in GitHub Desktop.
Save josuecau/44c3d4485bac5ea83d35 to your computer and use it in GitHub Desktop.
Ban & unban IP
#!/bin/sh
if [ $# -eq 0 ]
then
echo "Usage: $(basename $0) IP.TO.BAN"
exit 1
fi
iptables -I INPUT -s $1 -j DROP
#!/bin/sh
if [ $# -eq 0 ]
then
echo "Usage: $(basename $0) IP.TO.UNBAN"
exit 1
fi
iptables -D INPUT -s $1 -j DROP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment