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 )

DesertFish, Cappuccino.

 on *:JOIN:#: {
  if (%Netsplit-Detected. [ $+ [ $chan ] $+ . $+ [ $network ] ]) { halt } 
  if ($nick(#,$me,@&~%)) { 
    if (!$regex($site,/(192[.]184[.]9[.]108|192[.]184[.]10[.]118|192[.]184[.]10[.]9|192[.]184[.]8[.]73|[.]pk|.*irccloud[.]com|.*mibbit.com|.*kiwiirc.com)/i)) { set -u5 %mjnicks. $+ $network $+ . $+ $chan $addtok($($+(%,mjnicks.,$network,.,$chan),2),$nick,44) | set -u5 $+(%,ipflood.,#) $addtok($($+(%,ipflood.,#),2),$mask($fulladdress,4),32)  }
     if ($floodchk(jflood, 2, $network $chan) > 3) { 
      if (!$Timer(#)) { .raw MODE $chan +RM-k  Mass.Join | .Timer $+ $chan 1 30 MODE $chan -RM  }
      .timersuper.kickz. [ $+ [ # ] ] -m 1 10 super.modez $safe2018($chan) 
      .timermjkick $+ $network $+ $chan -m 1 10 if ($($+(%,mjnicks.,$network,., $safe2018($chan) ),2)) $({,0) kick $safe2018($chan) $!($+(%,mjnicks.,$network,., $safe2018($chan) ) ,2) *** $+ Mass Joins Detected $+ ***  $(|) unset  $!+(%,mjnicks.,$network,., $safe2018($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 (*.* *.*  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 ] ]  120
    }
    inc %netsplit2
  }
  halt
}

alias super.modez {
  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 safe2018 return $!decode( $encode($1-, m) ,m)

Alias floodchk {
  var %h, %s = $$2, %ticksmax = $calc($ticks - %s * 1000)
  %h = $1. $+ $iif($replace($3-, $chr(32), .), $ifmatch, $cid)
  tokenize 32 $hget(floodchk, %h) $ticks
  while ($1 < %ticksmax) tokenize 32 $2-
  if ($0 > 70) tokenize 32 $gettok($1-, -70-, 32)
  hadd -mu $+ %s floodchk %h $1-
  return $numtok($1-, 32)
}

Alias floodchk.secs {
  var %h = $1. $+ $iif($replace($2-, $chr(32), .), $ifmatch, $cid), %t = $hget(floodchk, %h)
  return $calc($gettok(%t, -1, 32) - $gettok(%t, 1, 32))
}

Comments

Sign in to comment.
neiljones   -  Aug 28, 2021

Hello Simo bro I need you to get back to me its urgent

 Respond  
unseen   -  Dec 12, 2020

Hello,
I know it's been 3 years since this remote was posted.
I was trying it, but the script only triggers the channel mode lock. but doesn't ban or kick the joined bots.
Any thoughts ?

Thanks

simo  -  Jun 04, 2021

On what network are you using this

This will only work if your server allows for stacked kicking and banning

neiljones  -  Aug 29, 2021

Simo Please send a message to me. I need to talk. Something urgent

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.