first commit
This commit is contained in:
37
src/ssh-kill-all
Executable file
37
src/ssh-kill-all
Executable 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
|
||||
Reference in New Issue
Block a user