Advertisement
voodooKobra

banip

Mar 12th, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # For Debian-based systems
  2. # Add this to your .bashrc
  3. banip() {
  4.   if [ -z $1 ]
  5.   then
  6.     echo "Parameter not passed."
  7.   else
  8.     iptables -A INPUT -s $1 -j DROP
  9.     iptables -A OUTPUT -d $1 -j DROP
  10.     echo "$1 banned."
  11.     #If you get an error, switch the comment out below 
  12.     #/etc/init.d/iptables save
  13.     iptables-save
  14.   fi
  15. }
  16. #usage: banip XX.XX.XX.XX
  17. # Blocks incoming and outgoing connections to a given IP or subnet
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement