anti mass join for servers that allow multi kick

By simo on Apr 15, 2018

this will kick on mass join abuse on servers wich allow multikicks on a single kick command
like inspIRCd and bahamut (dalnet)

on *:JOIN:#: {
  if ($nick(#,$me,@&~%)) { 
 if (%Netsplit-Detected. [ $+ [ $chan ] $+ . $+ [ $network ] ]) { halt }
    set -u6 %mjnicks. $+ $network $+ . $+ $chan $addtok($($+(%,mjnicks.,$network,.,$chan),2),$nick,44) 
    set -u6 $+(%,ipflood.,#) $addtok($($+(%,ipflood.,#),2),$mask($fulladdress,4),32)  
    inc -u2 %mjc. $+ $network $+ . $+ $chan 1
    if ($($+(%,mjc.,$network,.,$chan),2) > 3) {
      if (!$Timer(#)) { MODE $chan +RM-k  Mass.Join | .Timer $+ $chan 1 21 MODE $safe($chan) -RM   }
      .timerbans. [ $+ [ # ] ] -m 1 10 bans $safe($chan) 
      .timermjkick $+ $network $+ $chan -m 1 10 if ($($+(%,mjnicks.,$network,., $safe($chan) ),2)) $({,0) kick $safe($chan) $!($+(%,mjnicks.,$network,., $safe($chan) ) ,2) *** $+ Mass Joins Detected $+ ***  $(|) unset  $!+(%,mjnicks.,$network,., $safe($chan) ) $(},0) 
      if ($numtok($($+(%,mjnicks.,$network,.,$chan),2),44) == 4) { 
        kick $chan $($+(%,mjnicks.,$network,.,$chan),2) Mass Joins detected 
        .timermjkick $+ $network $+ $chan off      
        unset $eval($+(%,mjnicks.,$network,.,$chan),1)
      }
    }
  }
} 

ON !^*:QUIT: {
  var %netsplit2 1
  while ($comchan($nick,%netsplit2)) {
    var %netsplitchan $v1
     if ($regex($1-2,/(.*[.].*[.].*)/i) && !%Netsplit-Detected. [ $+ [ %netsplitchan ] $+ . $+ [ $network ] ]) {
      echo  %netsplitchan  $timestamp  12,00 Netsplit Detected between 05,00 $1 14,00 <> 05,00 $2  
      set -z %Netsplit-Detected. [ $+ [ %netsplitchan ] $+ . $+ [ $network ] ]  60
    }
    inc %netsplit2
  }
  if (%Netsplit-Detected. [ $+ [ %netsplitchan ] $+ . $+ [ $network ] ])  {  echo  %netsplitchan $timestamp  $chr(160)  $+ $color(quit) Quits : $chr(160)  $+ $color(quit)  $nick $chr(160)   $+ $color(quit)  $address   $+ $color(quit)  ( $+ $1- $+ )    }
}

alias bans {
  var %loop-a = 1
  while ($gettok($($+(%,ipflood.,$1),2),%loop-a,32)) {
    %bb = %bb $gettok($($+(%,ipflood.,$1),2),%loop-a,32)
    if ($modespl == $numtok(%bb,32)) { mode $1 $+(+,$str(b,$gettok(%bb,0,32))) %bb | %bb = "" }
    inc %loop-a
  }
  if (%bb) { mode $1 $+(+,$str(b,$gettok(%bb,0,32))) %bb | %bb = "" }
  $+(.timerx,$1) 1 0 unset $+(%,*,flood.,$1)
}

alias safe return $!decode( $encode($1-, m) ,m)

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.