Advertisement
Guest User

Untitled

a guest
Oct 13th, 2011
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. f_ban () {
  4. echo "Enter IP Address to Ban: "
  5. read address
  6. sudo iptables -I INPUT -s $address -j DROP
  7. sudo sh -c "iptables-save > /etc/iptables.rules"
  8. echo "IP Ban Complete."
  9. echo "Kick Player to finish Process"
  10. sleep 1
  11. }
  12.  
  13. f_show () {
  14. sudo iptables -L INPUT -n --line-numbers
  15. echo "Delete Record? (Y/N)"
  16. read choice
  17. if [ $choice = "y" -o $choice = "Y" ]; then
  18. echo "Enter Record to Drop"
  19. read addrdrop
  20. sudo iptables -D INPUT $addrdrop
  21. sudo sh -c "iptables-save > /etc/iptables.rules"
  22. fi
  23. }
  24.  
  25. while : # Loop forever
  26. do
  27. cat << !
  28.  
  29. ========= IP TABLES BAN IP MENU ==========
  30.  
  31. 1. Ban IP
  32. 2. Show / Modify Banned IPS
  33. 3. Quit
  34.  
  35. !
  36.  
  37. echo -n " Your choice? : "
  38. read choice
  39.  
  40. case $choice in
  41. 1) f_ban ;;
  42. 2) f_show ;;
  43. 3) exit ;;
  44. *) echo "\"$choice\" is not valid "; sleep 2 ;;
  45. esac
  46. done
  47.  
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement