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 User part" echo "Possible options are:" echo "--------------------" echo -e "\e[35m\e[1m--------User Part--------\e[0m" echo -e "\e[32mdomu X\e[0m" - show domain stat for X days echo -e "\e[31mexample: 112u domu trinotortosa.com 5\e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32museru \e[0m" - show current usage per user echo -e "\e[31mexample: 112u useru timhuntm\e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32mlve-cpu\e[0m" - show users that use 90% CPU last 10mins echo -e "\e[31mexample: 112u lve-cpu\e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32mlve-io\e[0m" - show users that use IO last 10mins echo -e "\e[31mexample: 112u lve-io\e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32mlve-fault\e[0m" - show users that have resources fault last 10mins echo -e "\e[31mexample: 112u lve-fault\e[0m" echo -e "\e[33m----------\e[0m" #echo -e "\e[32mdomlog \e[0m" - show last 20 ips that make wp-login or xmlrpc hack #echo -e "\e[31mexample: 112u domlog \e[0m" #echo -e "\e[33m----------\e[0m" #echo -e "\e[32mdom-csf \e[0m" - like above but generate csf ban ip comand #echo -e "\e[31mexample: 112u dom-csf\e[0m" #echo -e "\e[33m----------\e[0m" echo -e "\e[32mtopload \e[0m" - show top XX ot most load average cause users echo -e "\e[31mexample: 112u topload 20 or any number\e[0m" #echo -e "\e[33m----------\e[0m" #echo -e "\e[32mwphack \e[0m" - show last wp-login and xmlrpc hacks #echo -e "\e[31mexample: 112u wphack \e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32mchart \e[0m" - send graphs with user usage to mail echo -e "\e[31mexample: 112u chart pavlin@thmdhosting.net \e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32mbw \e[0m" - show user bandwith for the past 3 months echo -e "\e[31mexample: 112u bw username \e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32mbw \e[0m" - show lynx version of webalizer echo -e "\e[31mexample: 112u bwcheck username \e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32mroot \e[0m" - Generated ROOT access via WHM echo -e "\e[31mexample: 112u root \e[0m" echo -e "\e[33m----------\e[0m" echo -e "\e[32muser \e[0m" - Generated USER access via WHM echo -e "\e[31mexample: 112u user vortex5 \e[0m" echo -e "\e[33m----------\e[0m" echo "Have a nice work" echo "" fi #show stat for CPU usage by doman names for X days if [[ $1 == "domu" ]] ; then domain="$2"; for i in `seq 1 $3 `; do let i=$i+1 ; let k=$i-1 ; let s="$(date +%s) - (k-1)*86400"; let t="$(date +%s) - (k-2)*86400"; echo `date -Idate -d @$s`; /usr/local/cpanel/bin/dcpumonview `date -d @$s +%s` `date -d @$t +%s` | sed -r -e 's@^(.*)(.*)(.*)(.*)(.*)$@Account: \1\tDomain: \2\tCPU: \3\tMem: \4\tMySQL: \5@' -e 's@^Top Process(.*)(.*)$@\1 - \2@' | grep $domain -A3 ; done fi #show cpu usage for user if [[ $1 == "useru" ]] ; then /usr/local/cpanel/bin/dcpumonview | sed -e 's/<[^>]*>/ /g' | grep $2 fi #show current hack attempts from wp-login and xmlrpc if [[ $1 == "domlog" ]] ; then tail -n20 /etc/httpd/domlogs/*/* | egrep -w "(wp-login|xmlrpc.php)" | awk '{print $1}' | egrep "[0-9]" | sort -n | uniq -c | sort -n | tail -n20 fi #show current hack attempts from wp-login and xmlrpc and generate csf ban list if [[ $1 == "dom-csf" ]] ; then for i in `ionice -c3 nice -n19 tail -n20 /etc/httpd/domlogs/*/* | egrep -w "(wp-login|xmlrpc.php)" | awk '{print $1}' | egrep "[0-9]" | sort -n | uniq -c | sort -n | tail -n20 | awk '{print $2}'` ; do echo "csf -d $i" ; done fi #show top 20 of most CPU usage user. if [[ $1 == "topload" ]] ; then /usr/local/cpanel/bin/dcpumonview |grep "%" | grep "home" | sed -e 's/<[^>]*>/ /g' | awk '{print $4"%",$6,$7}' | sort -n | tail -n$2 fi #show png generatet stat for current user for past 7 days if [[ $1 == "chart" ]] ; then lvechart --user=$2 --period=7d --output=/tmp/$2.png echo -e "This user $2 is on $HOSTNAME hase ovelimit please check it" | mail -s 'statistic for last 7 days ' -a /tmp/$2.png $3 fi #show xmlrpc and wp-login requests if [[ $1 == "wphack" ]] ; then ps auxf | egrep "(xmlrpc|wp-login|administrator|[0-9]\.php)" fi #use LVE to find most CPU using users if [[ $1 == "lve-cpu" ]] ; then lveinfo --display-username --show-all --limit=10 --order-by=cpu_max --by-usage=cpu_max -p 90 --period=10m | tee /dev/stderr fi #use LVE to find most IO using users if [[ $1 == "lve-io" ]] ; then lveinfo --display-username --show-all --limit=10 --order-by=io_max --by-usage=io_max -p 90 --period=10m | tee /dev/stderr fi #use LVE to find most fault counting users if [[ $1 == "lve-fault" ]] ; then lveinfo --display-username --show-all --limit=10 --order-by=any_faults --by-fault=any -r 1 --period=5m | tee /dev/stderr fi #show users bandwith for past 3 months if [[ $1 == "bw" ]] ; then NOWM=`date +%m` PREVM=`date --date='-1 month' +%m` PREVPREVM=`date --date='-2 month' +%m` for i in $2 ; do BANDWIDTH3=`whmapi0 showbw search=$i searchtype=user month=$NOWM | grep totalbytes: | awk '{print $2}' | sed "s/[']//g" | awk '{print $1/1024/1024/1024}' ` BANDWIDTH2=`whmapi0 showbw search=$i searchtype=user month=$PREVM | grep totalbytes: | awk '{print $2}' | sed "s/[']//g" | awk '{print $1/1024/1024/1024}' ` BANDWIDTH1=`whmapi0 showbw search=$i searchtype=user month=$PREVPREVM | grep totalbytes: | awk '{print $2}' | sed "s/[']//g" | awk '{print $1/1024/1024/1024}' ` USERNAME=`whmapi0 showbw search=$i searchtype=user | grep user: | sed 's/ //g'` USERPLAN=`grep "PLAN" /var/cpanel/users/$2 ` echo "Bandwidth for $USERNAME" echo "-" echo "HostingPlan: $USERPLAN" echo "-" echo "Bandwidth for ($NOWM): $BANDWIDTH3 GB" echo "Bandwidth for ($PREVM) : $BANDWIDTH2 GB " echo "Bandwidth for ($PREVPREVM): $BANDWIDTH1 GB" echo "=====================" done fi #show users bandwith for past 3 months if [[ $1 == "bwcheck" ]] ; then lynx /home/$2/tmp/webalizer/usage_`date +%Y%m`.html fi #Generated USER access via WHM if [[ $1 == "user" ]] ; then whmapi1 create_user_session user=$2 service=cpaneld | grep url fi #Generated root access via WHM if [[ $1 == "root" ]] ; then whmapi1 create_user_session user=root service=whostmgrd | grep -i URL fi