Skip to content

Instantly share code, notes, and snippets.

@grahamg
Created February 1, 2012 22:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save grahamg/1719841 to your computer and use it in GitHub Desktop.
Save grahamg/1719841 to your computer and use it in GitHub Desktop.
Check the progress of a currently running maldet malware session, if not start one up in the background
#!/bin/bash
download_location=http://www.rfxn.com/downloads/maldetect-current.tar.gz
scan_location=/home?/?
maldet=/usr/local/sbin/maldet
dump_file='/root/maldet_$(pidof -x $maldet)_$(date +"%m-%d-%Y-%T").dump'
hash maldet 2>&- || {
echo >&2 "Maldetect not installed. Installing...";
wget --progress=dot $download_location -O /root/maldetect-current.tar.gz
tar xzf /root/maldetect-current.tar.gz -C /root/maldetect-current
source /root/maldetect-current/install.sh
echo >&2 "Installed";
}
if [ "$(pidof -x $maldet)" ]
then
i=$(grep maldet_$(pidof -x $maldet) /root/*)
if [ "$(i)" ]
then
cat $i
else
echo "Could not find maldet dump file in /root directory"
fi
else
source $maldet --update-ver > /dev/null
source $maldet --update > /dev/null
source $maldet -b -a $scan_location > $dump_file
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment