#!/bin/sh
rm -rf /tmp/cpmmess.tmp
if [ ! -f /opt/bin/cpm ]; then
	echo "CPM is missing from `hostname`!!  `date`" > /tmp/cpmmess.tmp
	mail -s "`hostname` CPM MISSING" root < /tmp/cpmmess.tmp
	rm -rf /tmp/cpmmess.tmp
	exit 1
fi
/usr/local/bin/cpm 2> /tmp/cpmmess.tmp
grep PROM /tmp/cpmmess.tmp
if [ $? = 0 ]; then
	echo "" >> /tmp/cpmmess.tmp
	echo "`date` on `hostname`" >> /tmp/cpmmess.tmp
	echo "" >> /tmp/cpmmess.tmp
	echo "Warning: This may indicate that a network traffic scanner" >> /tmp/cpmmess.tmp
	echo "(i.e. tcpdump) is being run on the machine to sniff information." >> /tmp/cpmmess.tmp
	mail -s "`hostname` PROMISCUOUS" root < /tmp/cpmmess.tmp
fi
rm -rf /tmp/cpmmess.tmp
