PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` #!/bin/bash if [[ $1 == "" ]] ; then echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-" echo "Welcome to IP part" echo "Possible options are:" echo "--------------------" echo -e "\e[35m\e[1m--------IP Part--------\e[0m" echo -e "\e[32mstat\e[0m" - it show stat for type of connection state echo -e "\e[31mexample: 112i stat\e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32m80 \e[0m"- count only connection that are in apache echo -e "\e[31mexample: 112i 80\e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32mcount\e[0m" - count all connection made by ip echo -e "\e[31mexample: 112i count\e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32mipkill IP \e[0m" - close all open TCP ports made by ip using fuser -k -n tcp echo -e "\e[31mexample: 112i ipkill 25.25.25.25\e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32mfreeip \e[0m" - check if there is free ips in server echo -e "\e[31mexample: 112i freeip \e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32musedip \e[0m" - count all used IP address echo -e "\e[31mexample: 112i usedip \e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32mht-on \e[0m" - disable via iptables 80 and 443 ports echo -e "\e[31mexample: 112i ht-on \e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32mht-off \e[0m" - enable via iptables 80 and 443 ports echo -e "\e[31mexample: 112i ht-off \e[0m" echo -e "\e[33m----------\e[0m" echo "Have a nice work" echo "" fi #this part count netstat connection types if [[ $1 == "stat" ]] ; then netstat -lapten | awk '{print $6}' | sort | uniq -c | sort -n fi #count and show all that use port 80 if [[ $1 == "80" ]] ; then netstat -antu | grep :80 fi #count all used connection by ip if [[ $1 == "count" ]] ; then netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n fi #kill ip from all ports using fuser if [[ $1 == "ipkill" ]] ; then for i in ` netstat -lapten | grep "CLOSE_WAIT" | grep "$2" | awk '{print $5}' | awk -F":" '{print $2}'` ; do fuser -k -n tcp $i ; done fi #enable and disable via iptables http services if [[ $1 == "ht-on" ]] ; then /sbin/iptables -A INPUT -p tcp --destination-port 80 -j DROP /sbin/iptables -A INPUT -p tcp --destination-port 443 -j DROP echo "" echo -e "\e[31mWARNING YOU JUST STOP ALL INCOMING CONNECTION TO HTTP SERVICES \e[0m" echo "" echo -e "\e[32mBE SHURE TO ENABLET IT BACK WITH 112i ht-off or csf -r ...or we are doomed ! \e[0m" fi if [[ $1 == "ht-off" ]] ; then /sbin/iptables -D INPUT -p tcp --destination-port 80 -j DROP /sbin/iptables -D INPUT -p tcp --destination-port 443 -j DROP fi # check free ips if [[ $1 == "freeip" ]] ; then for i in `ifconfig -a | grep "inet addr" | awk '{print $2}' | awk -F":" '{print $2}' | head -n25` ; do if [[ `grep $i /etc/httpd/conf/httpd.conf -c ` -eq "0" ]] ; then echo " $i is free and no one use it" ; fi ; done fi # count dedicated used IPs if [[ $1 == "usedip" ]] ; then echo "Dedicated IPs" for i in `ifconfig | grep "inet addr" | awk -F":" '{print $2}' | awk '{print $1}'` ; do echo "----$i---" ; grep -w $i /etc/httpd/conf/httpd.conf ; done | grep -a "\-\-" -A1 | grep VirtualHost -c fi