working version, for release

This commit is contained in:
2019-07-09 10:17:00 +03:00
parent da5c54017c
commit 97070ebe30
12 changed files with 200 additions and 111 deletions

37
utils/ssh-kill-all Executable file
View File

@@ -0,0 +1,37 @@
#/bin/bash
PATH=$PATH:$HOME/bin
pppid=$( ps --no-header o ppid $PPID )
ppcom=$( ps --no-header o comm $pppid )
if [[ $ppcom = sshd ]]; then
pgrep -u $USER -x sshd | while read pid; do
row=$( ps --no-header o pid,start,comm $pid )
printf "%s%s%s\r" $( qolop c Y ) "$row" $( qolop c Z )
sleep 0.5
if [[ $pid -eq $pppid ]]; then
printf "%s%s%s\r" $( qolop c G ) "$row" $( qolop c Z )
else
kill -9 $pid &> /dev/null
printf "%s%s%s\r" $( qolop c R ) "$row" $( qolop c Z )
fi
printf "\n"
done
pgrep -u $USER -x ssh | while read pid; do
row=$( ps --no-header o pid,start,comm $pid )
printf "%s%s%s\r" $( qolop c Y ) "$row" $( qolop c Z )
sleep 0.5
kill -9 $pid &> /dev/null
printf "%s%s%s\r" $( qolop c R ) "$row" $( qolop c Z )
printf "\n"
done
pgrep -u $USER -x python3 | while read pid; do
row=$( ps --no-header o pid,start,comm $pid )
printf "%s%s%s\r" $( qolop c Y ) "$row" $( qolop c Z )
sleep 0.5
kill -9 $pid &> /dev/null
printf "%s%s%s\r" $( qolop c R ) "$row" $( qolop c Z )
printf "\n"
done
fi