Subversion Repositories My Stuff

Rev

Rev 22 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 kardasa 1
#!/bin/sh
2
 
3
#####################################################################
4
# Script to send an email when chkrootkit test are being performed
5
#
6
# This script is distributed in the hope that it will be useful,
7
# but WITHOUT ANY WARRANTY; without even the implied warranty of
8
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9
# GNU General Public License for more details.
10
# Author: Andrzej Kardaƛ
11
# License: GPLv3 
12
# The full version of the licencse can be obtainted by visiting: 
13
# http://www.gnu.org/licenses/gpl.html
14
#######################################################################
15
 
16
SERVERNAME=$(hostname)
17
DATE=$(date +"%d.%m.%Y")
21 kardasa 18
EMAIL=administrator@emai.pl
20 kardasa 19
FILENAME="/var/tmp/fulltest-${DATE}.txt"
20
 
21
/usr/sbin/chkrootkit 2>&1 > ${FILENAME}
22
 
23
if (cat ${FILENAME} | grep -q "INFECTED\|Vulnerable") then
22 kardasa 24
        echo "There seems to be a problem!!!!" > /var/tmp/msgfile-${DATE}
20 kardasa 25
        echo "-------------------------------------------------" >> /var/tmp/msgfile-${DATE}
23 kardasa 26
        cat ${FILENAME} | grep "INFECTED\|Vulnerable" >> /var/tmp/msgfile-${DATE}
20 kardasa 27
        echo "-------------------------------------------------" >> /var/tmp/msgfile-${DATE}
28
        echo "You can see whole test results in attachment file" >> /var/tmp/msgfile-${DATE}
29
else
30
        echo "Your system is not infected" > /var/tmp/msgfile-${DATE}
31
        echo "You can see whole test results in attachment file" >> /var/tmp/msgfile-${DATE}
32
fi
33
 
34
/usr/bin/mutt -s "${DATE} Weekly chkrootkit from ${SERVERNAME}" ${EMAIL} -a ${FILENAME} < /var/tmp/msgfile-${DATE}
35
#