Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Portaudit script
- LOGFILE=/root/portaudit/lastlog.log
- MUTT=/usr/local/bin/mutt
- MSG=/root/portaudit/msg.txt
- MSGHASH=`openssl dgst -sha512 $MSG | cut -d' ' -f 2,8`
- DATE=`date +%d-%m-%Y`
- SENDEMAIL=/usr/local/bin/sendEmail
- mailme () {
- $SENDEMAIL -f security@xxx.com.br -t leandro@xxxx.com.br -u "Atualizacao de vulnerabilidades [`hostname | cut -d'.' -f 1 `] em \
- $DATE" -m " `portaudit -Fa | awk '/Affected/ { print } '/Type/' { print }'`\n \n `ls /var/db/pkg | wc -l` pacotes instalados e analisados. Data [$DATE] \
- \n \nMessage hash: $MSGHASH \n Keffer" -s mail.xxx.com.br:25 -xu security@xxxx.com.br -xp xxx
- if [ $? -eq 0 ]; then
- echo "Envio realizado com sucesso! $DATE" >> $LOGFILE
- else
- echo "\nErro no envio! [$DATE]" >> $LOGFILE
- exit 1;
- fi
- }
- if [ -s $MSG ]; then
- mailme
- echo "Message hash: $MSGHASH" > $LOGFILE
- #else
- #
- #$SENDEMAIL -f security@xxx.com.br -t leandro@xxxx.com.br -u "Nenhuma vulnerabilidade encontrada em [`hostname | cut -d'.' -f 1 `] $DATE" -m "Nenhuma vulnerabilidade encontrada \n \n`ls /var/db/pkg | wc -l` pacotes instalados e analisados. Data [$DATE] \n \nMessage hash: $MSGHASH \n Keffer" -s mail.xxxx.com.br:25 -xu security@xxx.com.br -xp xxx
- #
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement