CHips L MINI SHELL

CHips L pro

Current Path : /opt/zabbix_scripts/
Upload File :
Current File : //opt/zabbix_scripts/malicious.userSymlinkCounts.sh

#!/bin/bash
################################################################################################################
#                                                                                                              #
# !!!!!!!!! This file is automatically managed.  Do not edit directly.  Changes will be overwritten. !!!!!!!!! #
#                                                                                                              #
# Author:   William O.                                                                                         #
# Revision: 20210503.1334                                                                                      #
################################################################################################################


case $1 in
    "cron")
        declare -A cpanelUsersList=$(/usr/sbin/whmapi1 list_users | grep -E '\ *\-\ ' | awk '{print $2}' | grep -vE '^root$' | sort)

        for cpanelUser in ${cpanelUsersList[@]}
        do
            echo $cpanelUser `find /home/${cpanelUser}/public_html/ -type l | wc -l` | grep -vE '\ 0$'
        done | sort -g -r -k 2 > /opt/zabbix_output/UserSymlinkCounts.txt

	fileLineCount=`wc -l /opt/zabbix_output/UserSymlinkCounts.txt | awk '{print $1}'`

	if [[ ${fileLineCount} == "0"  ]]
        then
            echo "0" > /opt/zabbix_output/UserSymlinkCounts.txt
        fi
        ;;
    "zabbix")
        fileByteCount=`wc -c /opt/zabbix_output/UserSymlinkCounts.txt | awk '{print $1}'`
        if [[ ${fileByteCount} < "3"  ]]
        then
            fileContent=`cat /opt/zabbix_output/UserSymlinkCounts.txt`

            if [[ ${fileContent} == "0" ]]
            then
                echo "0"
            fi
        fi
        awk '{print $2}' /opt/zabbix_output/UserSymlinkCounts.txt | paste -sd+ - | bc
        ;;
    *)
        echo "Missing Argument"
        ;;
esac

Copyright 2K16 - 2K18 Indonesian Hacker Rulez