zoukankan      html  css  js  c++  java
  • Shell脚本实现非法IP登陆自动报警【转】

    服务器的安全稳定是每个运维都希望达到的目标,毕竟网站一旦流量大了,访问高了,就会有一些无聊人来攻击,帮忙检测漏洞是好,但纯ddos的性质就很恶劣了.说远了,这篇文章只是检测有非法ip登录到服务器上就自动给运维报警,当然也可以改成短信报警,前提是你有短信网关.

    #!/bin/bash
    
    #该脚本作用是检测是否有恶意IP登陆服务器并邮件报警
    
    #可以结合139邮箱以达到短信及时通知到手机的功能
    
    #适用系统centos5
    Ldate=`which date`
    
    Lawk=`which awk`
    
    Llast=`which last`
    
    Lgrep=`which grep`
    
    Lsendmail=`which sendmail`
    
    Lifconfig=`which ifconfig`
    
    serverip=`$Lifconfig eth0|$Lgrep inet|$Lawk -F : '{print $2}'|$Lawk '{print $1}'`
    
    cutdate=`$Ldate |$Lawk '{print $1" "$2" "$3}'`
    
     
    
    hackerip=`$Llast|$Lgrep "$cutdate"|$Lawk '{print $3}'|$Lgrep -v 192.168.1x.xx`
    
     
    
    if [ -z $hackerip ]
    
    then
    
    exit
    
    else
    
     
    
    for logip in $hackerip
    
    do
    
    echo "hacker ip is  $logip already login  $serverip"|mail -s "SOS" rocdk890@139.com
    
     
    
    done
    
    fi

    转自

    Shell脚本实现非法IP登陆自动报警 - Lai18.com IT技术文章收藏夹
    http://www.lai18.com/content/386124.html

  • 相关阅读:
    elment ui 日期限制
    javascript中的编码与解码
    vue3 px 转ref
    css 波浪线
    初始化css
    vue 3 的复制功能 vue-clipboard3
    二维数组转一维数组、对象数组互斥去重
    分享几个数组方法
    前端生成图形验证码
    rem自适应布局,移动版
  • 原文地址:https://www.cnblogs.com/paul8339/p/6722165.html
Copyright © 2011-2022 走看看