iptables-http-clear 298 B

1234567891011121314
  1. #!/bin/bash
  2. # Clear all rules for port 80
  3. while :
  4. do
  5. last_num="0"
  6. while read rnum; do
  7. last_num="$rnum"
  8. done < <(/sbin/iptables -L INPUT -n --line-numbers | /bin/grep 'tcp dpt:80' | /usr/bin/awk '{print $1}')
  9. if [ "$last_num" = "0" ]; then
  10. break
  11. fi
  12. /sbin/iptables -D INPUT $last_num
  13. done