March 20, 2004

Nickflood kickban, revolving door ban

This first snippet will kickban somebody from all channels you have ops in if they change their nick three times in 30 seconds. The ban is temporary (60 seconds).

on *:NICK: {
  inc -u30 $+(%,$wildsite,.nflood)
  if ($($+(%,$wildsite,.nflood),2) >= 3) {
    var %ch = $comchan($newnick,0)
    while (%ch) {
      if ($comchan($newnick,%ch).op) {
        ban -ku60 $comchan($newnick,%ch) $newnick 3 Nick flood detected.
      }
      dec %ch
    }
  }
}

If you want to increase or lower the trigger time, change the 30 in the second line of the script to any number of seconds (though I don't suggest going much higher than 30 if you keep three nickchanges as the trigger number).
If you want to increase or lower the trigger number of nickchanges, change the 3 in the third line of the script to whatever number you want.
If you want to increase or decrease the ban length, change the 60 in the ban line to any number of seconds you want (to make the ban permanent, remove the -u60 switch entirely).

If you want this to only work in one channel, use this instead (putting your channel name where I put #CHANNEL):

on *:NICK: {
  if ($newnick ison #CHANNEL) {
    inc -u30 $+(%,$wildsite,.nflood)
    if ($($+(%,$wildsite,.nflood),2) >= 3) {
      ban -ku60 #CHANNEL $newnick Nick flood detected.
    }
  }
}

This second snippet is a "revolving door" ban. It will ban temporarily (60 secs) anybody who joins a channel you have ops in and then parts it again within 5 seconds. It's simple enough to customize this one, so I'm going to leave it as an exercise to the reader ;)

on @*:JOIN:#:{
  set -u5 $+(%,$wildsite,.,$chan,.rd) on
}
on @*:PART:#:{
  if ($($+(%,$wildsite,.,$chan,.rd),2)) { ban -u60 $chan $address($nick,3) }
}
Posted by sailoreagle at March 20, 2004 07:27 PM | Scripts
Comments