非法ip登录自动报警
服务器的安全稳定是每个运维都希望达到的目标,毕竟网站一旦流量大了,访问高了,就会有一些无聊人来攻击,帮忙检测漏洞是好,但纯ddos的性质就很恶劣了.说远了,这篇文章只是检测有非法ip登录到服务器上就自动给运维报警,当然也可以改成短信报警,前提是你有短信网关.
10 | Lsendmail=` which sendmail` |
11 | Lifconfig=` which ifconfig ` |
12 | serverip=`$Lifconfig eth0|$Lgrep inet|$Lawk -F : '{print $2}' |$Lawk '{print $1}' ` |
13 | cutdate=`$Ldate |$Lawk '{print $1" "$2" "$3}' ` |
15 | hackerip=`$Llast|$Lgrep "$cutdate" |$Lawk '{print $3}' |$Lgrep - v 192.168.1x.xx` |
24 | echo "hacker ip is $logip already login $serverip" |mail -s "SOS" rocdk890@139.com |
http://www.oschina.net/code/snippet_104610_2197
标签: shell ip 检测 报警 非法
评论: