Advertisement
Guest User

Untitled

a guest
Aug 13th, 2017
564
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. ##Logger script for RH/FC/CentOS
  3. Now2=$(date +%b\ %d)
  4. Now=$(date +%b\ %e)
  5. Hostname=$(hostname)
  6. Sender=log@$Hostname
  7. Recipient="your-own@whatever-mail.com"  ## send email to here not localhost..
  8. Subject="Daily-Log-Fileof-SHELLBOX-$Hostname"
  9. last |grep "$Now" > /var/log/lastlogon.log.txt
  10. cat /var/log/secure |grep "Failed pass for:" |grep "$Now" >
  11. /var/log/faillogon.log.txt
  12. 1cat /var/log/secure |grep "subsystem request for sftp" -n1 |grep
  13. "$Now"
  14. > /var/log/sftp.log.txt
  15. cat /var/log/secure |grep "sudo:" |grep "$Now" > /var/log/sudo.log.txt
  16. cat /var/log/messages |grep "su(pam_unix)" |grep "$Now" > /var/log/su.log.txt
  17. cat /var/log/yum.log |grep "$Now2" >> /var/log/up2date.log.txt
  18. lastcomm --tty pts/0 pts/1 pts/2 pts/3 pts/4 pts/5 pts/6 tty1 tty2 tty3
  19. tty4 tty5 tty6 |grep "$Now" > /var/log/audit.log.txt
  20. cat /var/log/.history-timestamp |grep "$Now" > /var/log/history.log.txt
  21. du -sh /var/www/* > /var/log/www-size.log.txt
  22. #mailx -r $Sender -s $Subject -a /var/log/history.log -a
  23. /var/log/su.log -a /var/log/lastlogon.log -a /var/log/faillogon.log -a
  24. /var/log/sftp.log -a
  25. /var/log/sudo.log -a /var/log/up2date.log $Recipient <
  26. /root/send_secure_content
  27.  
  28. ## might adjust this so it utilises simple 'mail' cmd.. -todo maybe, depends how good it works as is...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement