Anti-Mass-Join

By simo on May 16, 2017

Most modern updated IRCD's have all kinds of features to prevent mass joins some dont tho and those that have usually only lock channel if mass joins detected not removing mass joiners therefor this code might be some sort of solution for that part

some networks ( like dalnet ) have notting at all to counter mass joins

this will get rid of mass joins swiftly and set bans to prevent rejoins and set temporare channel lock

( it wont trigger on net split )

credits go to Neo Nemesis i modified his code a bit

Cappuccino.

on *:JOIN:#: {
  if (%Netsplit-Detected. [ $+ [ $chan ] $+ . $+ [ $network ] ]) { return }
  if ($nick(#,$me,@&~%)) {  
    set -u3 %mj1 $addtok(%mj1,$nick,44)
    hinc -mu3 massjoin $chan 1
    if ($hget(massjoin,#) >= 3) {
      if (%modechan != $true) {
        .raw mode  $chan +MR
        echo $chan $timestamp  01,08 ( Mass-Join Flood ) !!!!! Channel Locked !!!!!  
        set -u3 %modechan $true
        set -u3 %mj2 1
        .timermsj-R 1 30 mode $chan -R
        .timermsj-M 1 60 mode $chan -M
}
      while (%mj2 <= $numtok(%mj1,44)) {
        if ($gettok(%mj1,%mj2,44) ison $chan) {
          banMJ $gettok(%mj1,%mj2,44) $chan  
          if (%mj2 <= 15) { kick $chan $gettok(%mj1,%mj2,44) Mass Joins Detected  -1-  } 
          if (%mj2  >= 16) { kick $chan $gettok(%mj1,%mj2,44) Mass Joins Detected -2- } 
        }
        inc %mj2
      }
    }
  }
}

alias banMJ {
 if ($regex($address($1,2),/(irccloud)/i)) { mode $2 +b $regsubex($mid($address($1,0),3),/(~?[^@]+)@.*(?=\.[^.]+\..+)/,*!\1@*\2)   | halt  } 
 elseif (!$regex($gettok($address($1,2),-1,64),/[a-zA-Z]/g)) { 
    mode $2 +b $+($gettok($address($1,2),1-3,46),.*)
  }    
  else {
    mode $2 +b $+(*!*@*.,$gettok($address($1,2),2-,46))  
  } 
}

ON !^*:QUIT: {
  var %netsplit2 1
  while ($comchan($nick,%netsplit2)) {
    var %netsplitchan $v1
    if (*.* iswm $1-2) ) && (!%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- $+ )    }
}

ON *:LOAD:{ hmake massjoin 100  }
On *:start: { hmake massjoin 100 }

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.