tglogo.png
0 LIKES

Snippet


Anti-Mass-Join by simo

In Category General IRC Posted by Snippets On 12/06/23
Tags: mass join simo 

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 )
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 0


Please note that on our website we use cookies necessary for the functioning of our website, cookies that optimize the performance. To learn more about our cookies, how we use them and their benefits, please read our Cookie Policy.
I Understand