#!/bin/ksh ######################################################## # Check for bad SU attempts - Doug Burton - 3/25/2003 # # Cron entry: # # Check bad su attempts every hour. # 59 0-23 * * * /usr/local/bin/chk_su > /dev/null 2>&1 # # http://home.tampabay.rr.com/batcave/ ######################################################## function count { cat /var/adm/sulog | grep `date "+%m/%d"` | \ grep " - " | grep `date "+%H"` | wc -l } function stuff { cat /var/adm/sulog | grep `date "+%m/%d"` | \ grep " - " | grep `date "+%H"` } if [ $(count) -ne "0" ] then stuff | mailx -s "Bad SU attempts" root fi