Shell script implementation of illegal IP landing automatic alarm "turn"

Source: Internet
Author: User

The security and stability of the server is the goal that every operation and maintenance want to achieve, after all, once the website traffic is big, access is high, there will be some boring people to attack, to help detect the vulnerability is good, but the nature of pure DDoS is very bad. Said far, this article only detects that there is an illegal IP login to the server automatically to the Of course, it can be changed to SMS alarm, if you have a message gateway.

#!/bin/bash# This script function is to detect whether there is a malicious IP login server and mail alarm # can be combined with 139 of mailboxes to achieve SMS timely notification to the function of mobile phone # applicable system centos5
Ldate= 'which Date' Lawk=`which awk' Llast=`which  Last' Lgrep=`which grep' Lsendmail=`whichSendMail ' Lifconfig=`which ifconfig' ServerIP= ' $Lifconfig eth0| $Lgrep inet| $Lawk-F:'{print $}'| $Lawk'{print $}'' Cutdate= ' $Ldate | $Lawk'{print $ "" $ "" $ $} "'' Hackerip= ' $Llast | $Lgrep"$cutdate"| $Lawk'{print $}'| $Lgrep-V192.168. 1x.xx 'if[ -Z $hackerip] ThenExitElse  forLogipinch$hackerip DoEcho "Hacker IP is $LOGIP already login $serverip"|mail-s"SOS"[Email protected]139. com Donefi

Turn from

Shell script implementation Illegal IP login automatic alarm-lai18.com IT technology articles favorites
Http://www.lai18.com/content/386124.html

Shell script implementation of illegal IP landing automatic alarm "turn"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.