Last active
February 23, 2020 13:38
-
-
Save hoangdh/1a0787f79b42c94875329dbfd5dea2b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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