[ SEA-GHOST MINI SHELL]
#!/bin/bash
IFS=$'\n'
pcnt=$1
interval=$2
ps_list=""
result=""
list=$(sudo iotop -o -qqq -n $interval | awk '{print $1,$10,$12}')
for i in $list
do
if [ $(echo "$(echo ${i}| awk '{print $2}') > ${pcnt}"| bc -l) -eq 1 ]; then
ps_list=$(printf "${ps_list}\n${i}")
fi
done
for k in $(echo "${ps_list}"| awk '{print $1}'| sort | uniq -c)
do
if [[ $(echo "${k}"| awk '{print $1}') == $interval ]]; then
ps_id=$(echo "${k}" | awk '{print $2}')
ps_name=$(echo "${ps_list}" | grep "${ps_id}" | awk '{print $3}' | head -n 1)
ps_util=$(echo "${ps_list}" | grep "${ps_id}" | awk '{print $2}' | sort -n| head -n 1)
result+="$ps_name($ps_id): $ps_util%; "
fi
done
echo "${result}"
SEA-GHOST - SHELL CODING BY SEA-GHOST