[ SEA-GHOST MINI SHELL]

Path : /proc/2/cwd/proc/2/cwd/proc/2/cwd/proc/2/task/2/cwd/var/lib/zabbix/
FILE UPLOADER :
Current File : //proc/2/cwd/proc/2/cwd/proc/2/cwd/proc/2/task/2/cwd/var/lib/zabbix/cp-usync.sh

#!/bin/bash

serviceName="cp-usync"
crit="1"
file="/var/log/sync.log"
maxAge="5400" #sec in 1.5h
maxWaitTime="20"

pid="$(ps -elf | grep [u]sync-users.py | awk '{print $4}')"
if [ ! -z "$pid" ]; then
    timeout $maxWaitTime bash -c 'while [ -e /proc/$0 ]; do sleep 1.1; done' $pid
    if [ "$?" -gt 0 ];then
        echo "1 $serviceName - usync-users.py csript is running more then $maxWaitTime sec"
        exit
    fi
fi

currentTime=$(date +%s)
modTime=$(stat $file -c %Y)

delta=$(($currentTime - $modTime))


if [[ $delta -lt $maxAge ]]; then
  data=$(grep "Execution completed successfully" $file | wc -l)
  if  [[ $data -eq "1" ]]; then
      echo "1"
      exit 0
    elif [[ $data -eq "0" ]]; then
      echo "2"
    else
      echo "3"
    fi
else
  echo "4"
fi


#1: 0 $serviceName - Execution completed successfully $(($delta/60)) min ago
#2: 2 $serviceName - Execution completed successfully. Last attempt $(($delta/60)) min ago
#3: 3 $serviceName - Somesing goes wrong
#4: 2 $serviceName - The last execution was more than $(($maxAge/60)) min ago



SEA-GHOST - SHELL CODING BY SEA-GHOST