Subversion Repositories My Stuff

Rev

Rev 23 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

#!/bin/sh

#####################################################################
# Script to send an email when chkrootkit test are being performed
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# Author: Andrzej Kardaƛ
# License: GPLv3
# The full version of the licencse can be obtainted by visiting:
# http://www.gnu.org/licenses/gpl.html
#######################################################################

SERVERNAME=$(hostname)
DATE=$(date +"%d.%m.%Y")
EMAIL=administrator@emai.pl
FILENAME="/var/tmp/fulltest-${DATE}.txt"

/usr/sbin/chkrootkit 2>&1 > ${FILENAME}

if (cat ${FILENAME} | grep -q "INFECTED\|Vulnerable" | fgrep -v "Checking `bindshell'... INFECTED (PORTS: 465)" ) then
        echo "There seems to be a problem!!!!" > /var/tmp/msgfile-${DATE}
        echo "-------------------------------------------------" >> /var/tmp/msgfile-${DATE}
        cat ${FILENAME} | grep "INFECTED\|Vulnerable" >> /var/tmp/msgfile-${DATE}
        echo "-------------------------------------------------" >> /var/tmp/msgfile-${DATE}
        echo "You can see whole test results in attachment file" >> /var/tmp/msgfile-${DATE}
else
        echo "Your system is not infected" > /var/tmp/msgfile-${DATE}
        echo "You can see whole test results in attachment file" >> /var/tmp/msgfile-${DATE}
fi

/usr/bin/mutt -s "${DATE} Weekly chkrootkit from ${SERVERNAME}" ${EMAIL} -a ${FILENAME} < /var/tmp/msgfile-${DATE}
#