Skip to content

Instantly share code, notes, and snippets.

@hoangdh
Last active March 7, 2020 04:53
Show Gist options
  • Save hoangdh/924beae83205020a5b5f3e610bbcbf12 to your computer and use it in GitHub Desktop.
Save hoangdh/924beae83205020a5b5f3e610bbcbf12 to your computer and use it in GitHub Desktop.
#!/bin/bash
users=`cat /tmp/malware.detect | grep "tmp" | awk -F '/' {'print $3'}`
if [ -n "$users" ]
then
for x in $users
do
pid=`pgrep -u $x`
if [ -n "$pid" ]
then
kill -9 $pid
echo "$x : Killed proccess: $pid."
else
echo "$x : No proccess."
fi
file=`cat /tmp/malware.detect | grep $x | cut -d "|" -f1`
if [ -e $file ]
then
rm -rf $file
echo "$x: Removed: $file."
else
echo "$x : No file."
fi
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment