make it invisible to those ip..

#! /bin/bash
#
IP=`echo $* | sed ‘s/^.* from //’ | awk ‘{print $1}’ | sed ‘s/::ffff://’`
ATTEMPTS=`grep $IP /var/log/secure | grep “Failed password for”  | wc -l`

if [ $ATTEMPTS -gt 2 ] then
route add $IP lo
MINUTES=`expr $ATTEMPTS – 2`
echo “route del $IP lo 2> /dev/null” | at now +$MINUTES minutes 2>&1 > /tmp/.bad_user.$$
(hostname ; echo $* ; echo “IP=$IP” ; echo “ATTEMPTS=$ATTEMPTS” ; \
echo “Blocking for $MINUTES minutes” ; \
cat /tmp/.bad_user.$$ ) | Mail -s “bad user” root
fi

rm -f /tmp/.bad_user.$$
~

Related Post

4 Responses

  1. goysar says:

    I m using centos, i tried ur installation step and gone fine but finally when i ran the command ‘service zm start’ my terminal says ‘bash: service: command not found’ wat might be the error. I want my web cam from mron to work.

    Reply
  2. namran says:

    have you become root first before issue
    with

    “su – ”

    “service zm start” ?

    can be also as ..

    “/sbin/service zm start”

    or
    “/etc/init.d/zm start”

    Reply
  3. umsrootqho says:

    hunfjcmph, ippbsesekz

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *