Skip to content
TG007 community snippet #159

Anti-Mass-Join by 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

By Snippets Added Dec 6, 2023
General IRC All snippets
mIRC script 57 lines
About this snippet

Overview

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 )
Source code

mIRC script

57 lines · 2,679 characters
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))
}
Community

Comments

Want to join the discussion? Sign in to TG007.
No comments yet. Start the discussion.