Script:SecCheck

[Bearbeiten] SecCheck.sh

Überprüfung von möglichen Sicherheitsupdates für Gentoo

Datei: seccheck.sh
 
# change this! :)
email="root"
 
checkGLSA () {
tmpfile="/tmp/GLSA_${RANDOM}"
mailfile="/tmp/GLSA_${RANDOM}"
IFS="
"
glsa-check -n --list 2>/dev/null > $tmpfile
lines=`perl -0777pe 's/^(?:.*\n){4}//' $tmpfile`
rm -f $tmpfile
year=`date +%Y`
for each in $lines; do
        GLSAn=`echo "$each"|cut -d' ' -f1`
        type=`echo "$each"|cut -d' ' -f2`
        case $type in
            *N*)
                if [ "$got" != 1 ] ; then
                    got=1
                    echo "$HOSTNAME could be affected by this vulnerability:" >> $mailfile
                    echo >> $mailfile
                fi
                glsa-check --dump $GLSAn 2>/dev/null >> $mailfile
                ;;
        esac
done
}
 
checkGLSA
#cat $mailfile|mail $email -s 'new GLSA vulnerability found!! Check your machine.'
cat $mailfile
 
if [ "$got" == 1 ] ; then
        rm -f $tmpfile $mailfile
else
        exit 0
fi