Skip to content

Instantly share code, notes, and snippets.

@hoangdh
Last active February 23, 2020 13:38
Show Gist options
  • Save hoangdh/1a0787f79b42c94875329dbfd5dea2b5 to your computer and use it in GitHub Desktop.
Save hoangdh/1a0787f79b42c94875329dbfd5dea2b5 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Find execute files
mal=`find /home/*/.cagefs/tmp/ -type f -maxdepth 1 -executable 2> /dev/null`
# Writing to file
if [ -z "$mal" ]
then
echo "OK - No malware file detected." > /tmp/malware.detect
else
count=`echo $mal | wc -w`
echo "WARNING - $count malware file(s) detected." > /tmp/malware.detect
for x in $mal
do
# Define domain user's
user=$(echo $x | cut -d "/" -f3)
cron=$(cat /var/spool/cron/$user)
dom=$(grep $user /etc/domainusers | head -n1)
echo -e "$x | $dom \n $cron" >> /tmp/malware.detect
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment