Advertisement
Guest User

Untitled

a guest
Jul 1st, 2017
474
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. #!/bin/sh
  2. # Portaudit script
  3.  
  4. LOGFILE=/root/portaudit/lastlog.log
  5.  
  6. MUTT=/usr/local/bin/mutt
  7. MSG=/root/portaudit/msg.txt
  8. MSGHASH=`openssl dgst -sha512 $MSG | cut -d' ' -f 2,8`
  9. DATE=`date +%d-%m-%Y`
  10. SENDEMAIL=/usr/local/bin/sendEmail
  11.  
  12. mailme () {
  13. $SENDEMAIL -f security@xxx.com.br -t leandro@xxxx.com.br -u "Atualizacao de vulnerabilidades [`hostname | cut -d'.' -f 1 `] em \
  14. $DATE" -m " `portaudit -Fa | awk '/Affected/ { print } '/Type/' { print }'`\n \n `ls /var/db/pkg | wc -l` pacotes instalados e analisados. Data [$DATE] \
  15. \n \nMessage hash: $MSGHASH \n Keffer" -s mail.xxx.com.br:25 -xu security@xxxx.com.br -xp xxx
  16. if [ $? -eq 0 ]; then
  17. echo "Envio realizado com sucesso! $DATE" >> $LOGFILE
  18. else
  19. echo "\nErro no envio! [$DATE]" >> $LOGFILE
  20. exit 1;
  21. fi
  22. }
  23.  
  24. if [ -s $MSG ]; then
  25.  
  26. mailme
  27. echo "Message hash: $MSGHASH" > $LOGFILE
  28.  
  29. #else
  30. #
  31. #$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
  32. #
  33. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement