shell 入侵检测与邮件警报
shell 入侵检测跟邮件报警
#!/bin/bash
webdir=/var/www/html
cd $webdir
md5sum -c --quitet /opt/webfile.db
if [ $? -eq 0 ];then
echo "web file is ok"
else
echo ""
fi
find /var/www/html/-type f >/opt/countfile.db
count=`diff /opt/countfile.db*|wc -l`
if [ $count -gt 0 ];then
echo "then file_count is changed"
#mail -s "count_err" fz@163.com
else
echo "ok"
fi