123456789101112131415161718192021 |
- #!/bin/bash
- # Check for root user
- CURR_USER=`/usr/bin/whoami`
- if [ "$CURR_USER" != "root" ]; then
- echo "I need root rights... Please login from root"
- exit
- fi
- # Clear all rules for port 80
- while :
- do
- last_num="0"
- while read rnum; do
- last_num="$rnum"
- done < <(/sbin/iptables -L INPUT -n --line-numbers | /bin/grep 'tcp dpt:80' | /usr/bin/awk '{print $1}')
- if [ "$last_num" = "0" ]; then
- break
- fi
- /sbin/iptables -D INPUT $last_num
- done
|