Jump to content

Archived

This topic is now archived and is closed to further replies.

chain

Channel Botnet Flood Protection

Recommended Posts

  • Administrators
alias ialscan {
  return $ialchan($$2,$$1,0)
}
 
alias ialnicks {
  var %i = 1
  var %z = $ialscan($$1,$$2)
  var %ns = $null
  while (%i <= %z) {
    var %n = $ialchan($$2,$$1,%i).nick
    var %ns = $addtok(%ns,%n,32)
    inc %i 1
  }
  return %ns
}
 
alias ialkick {
  var %ii = 1
  var %zz = $ialscan($$1,$$2)
  var %ns = $ialnicks($$1,$$2)
  var %nm = $iif($3,$3-,Clones from $$2)
  while (%ii <= %zz) {
    var %n = $gettok(%ns,%ii,32)
    kick $$1 %n %nm
    inc %ii 1
  }
}
 
; [m]ass[k]ick[b]an
; usage : /mkb #chan nick1 nick2 nick3 ...
alias mkb {
  mb $1-
  mk $1-
}
 
; [m]ass[b]an alias
; usage : /mb #chan nick1 nick2 nick3 ...
alias mb {
  if (%mb.chan) {
    if (%mb.chan != $$1) {
      mode %mb.chan + $+ $str(b,$numtok(%mb.masks,32)) %mb.masks
      unset %mb.masks
    }
  }
  set -u10 %mb.chan $$1
  tokenize 32 $2-
  while ($1) {
    var %x = 1
    var %mb.ibl.total = $ibl(%mb.chan,0)
    var %mb.ibl.check = 0
    var %mb.ibl.address = $iif($address($1,2),$address($1,2),$hget(floodbanmask,$1))
    while (%x <= %mb.ibl.total) {
      if ($ibl(%mb.chan,%x) == %mb.ibl.address) {
        %mb.ibl.check = 1
      }
      inc %x 1
    }
    if (!%mb.ibl.check) {
      set %mb.masks $addtok(%mb.masks,%mb.ibl.address,32)
    }
    tokenize 32 $2-
    if ($numtok(%mb.masks,32) == 6) {
      mode %mb.chan + $+ $str(b,$numtok(%mb.masks,32)) %mb.masks
      .timermbban off
      unset %mb.masks
    }
  }
  if (%mb.masks) {
    .timermbban 1 1 mode %mb.chan + $+ $str(b,$numtok(%mb.masks,32)) %mb.masks
    .timermbban2 1 1 unset %mb.masks
  }
}
 
; [m]ass[k]ick alias
; usage : /mk #chan nick1 nick2 nick3 ...
alias mk {
  var %mk.chan = $$1
  tokenize 32 $2-
  while ($1) {
    if (!$timer(mk. [ $+ [ $1 ] ])) {
      inc -u10 %mk 5
      .timermk. [ $+ [ $1 ] ] 1 %mk mk2 %mk.chan $1
    }
    tokenize 32 $2-
  }
}
 
; since /mk starts a timer, /mk2 checks to see if they're
; still there before kicking when kick timer(s) trigger(s)
alias mk2 {
  if ($2 ison $1) {
    inc -u30 %mktotal 1
    ialkick $1 $address($2,2) %mktotal
  }
}
 
on shitlist:join:#:{
  mkb $chan $nick
}
 
alias autoshit {
  set -u60 %auto.shitlist. [ $+ [ $$1 ] ] 1
  msg $$1 Auto-Shitlisting anyone joining for the next 60 seconds
}
 
alias plusm {
  if ($network == dalnet) { var %mode.m = M }
  else { var %mode.m = m }
  mode $$1 + $+ %mode.m
  .timerminusr [ $+ [ $chan ] ] 1 120 mode $$1 - $+ %mode.m
}
 
alias plusr {
  if ($network == dalnet) { var %mode.r = R }
  else { var %mode.r = r }
  mode $$1 + $+ %mode.r
  .timerminusr [ $+ [ $chan ] ] 1 120 mode $$1 - $+ %mode.r
}
 
alias plusmr {
  if ($network == dalnet) { var %mode.mr = MR }
  else { var %mode.mr = mr }
  mode $$1 + $+ %mode.mr
  .timerminusmr [ $+ [ $chan ] ] 1 120 mode $$1 - $+ %mode.mr
}
 
; (F)lood (S)hift (N)icks
alias fsn {
  set %fsn.7 %fsn.6 | set %fsn.6 %fsn.5 | set %fsn.5 %fsn.4 | set %fsn.4 %fsn.3 | set %fsn.3 %fsn.2 | set %fsn.2 %fsn.1 | set %fsn.1 $$1
  set %fsn %fsn.7 %fsn.6 %fsn.5 %fsn.4 %fsn.3 %fsn.2 %fsn.1
  .timerunsetfsn 1 15 unset %fsn*
}
 
 
on @*:join:#:{
  hadd -mu15 $chan joined $+ . $+ $nick 1
  if (%auto.shitlist. [ $+ [ $chan ] ] == 1) {
    auser shitlist $address($nick,2)
    mkb $chan $nick
  }
  elseif ($regex($nick,/\d\d\d/)) {
    fsn $nick
    inc -u15 %random.nick. [ $+ [ $chan ] ] 1
    if (%random.nick. [ $+ [ $chan ] ] == 6) {
      plusm $chan
    }
    elseif (%random.nick. [ $+ [ $chan ] ] == 7) {
      mkb $chan %fsn $nick | unset %fsn*
    }
    elseif (%random.nick. [ $+ [ $chan ] ] == 15) {
      plusr $chan
      mkb $chan $nick
    }
    elseif (%random.nick. [ $+ [ $chan ] ] > 7) {
      mkb $chan $nick
    }
  }
  else {
    if (%clone.flood. [ $+ [ $chan ] $+ [ $site ] ]) {
      fsn $nick
      inc -u30 %clone.flood. [ $+ [ $chan ] ] 1
      if (%clone.flood. [ $+ [ $chan ] ] == 6) {
        plusm $chan
      }
      elseif (%clone.flood. [ $+ [ $chan ] ] == 7) {
        mkb $chan %fsn $nick
      }
      elseif (%clone.flood. [ $+ [ $chan ] ] == 15) {
        plusr $chan
        mkb $chan $nick
      }
      elseif (%clone.flood. [ $+ [ $chan ] ] > 3) {
        mkb $chan $nick
      }
    }
    inc -u30 %clone.flood. [ $+ [ $chan ] $+ [ $site ] ] 1
  }
}
 
on @*:text:*:#:{
  if (($nick isop $chan) || (exempt isin $level($fulladdress))) halt
  if ($hget(text.floodpro, $chan) == $1-) {
    fsn $nick
    inc -u15 %repeat.counter. [ $+ [ $chan ] ] 1
    if (%repeat.counter. [ $+ [ $chan ] ] == 6) {
      plusm $chan
    }
    elseif (%repeat.counter. [ $+ [ $chan ] ] == 7) {
      mkb $chan %fsn $nick | unset %fsn*
    }
    elseif (%repeat.counter. [ $+ [ $chan ] ] == 15) {
      plusr $chan
      mkb $chan $nick
    }
    elseif (%repeat.counter. [ $+ [ $chan ] ] > 7) {
      mkb $chan $nick
    }
  }
  hadd -m text.floodpro $chan $1-
}
 
on @*:action:*:#:{
  if (($nick isop $chan) || (exempt isin $level($fulladdress))) halt
  if ($hget(text.floodpro, $chan) == $1-) {
    fsn $nick
    inc -u15 %repeat.counter. [ $+ [ $chan ] ] 1
    if (%repeat.counter. [ $+ [ $chan ] ] == 6) {
      plusm $chan
    }
    elseif (%repeat.counter. [ $+ [ $chan ] ] == 7) {
      mkb $chan %fsn $nick | unset %fsn*
    }
    elseif (%repeat.counter. [ $+ [ $chan ] ] == 15) {
      plusr $chan
      mkb $chan $nick
    }
    elseif (%repeat.counter. [ $+ [ $chan ] ] > 7) {
      mkb $chan $nick
    }
  }
  hadd -m text.floodpro $chan $1-
}
 
on @*:notice:*:#:{
  if (($nick isop $chan) || (exempt isin $level($fulladdress))) halt
  if ($hget(text.floodpro, $chan) == $1-) {
    fsn $nick
    inc -u15 %repeat.counter. [ $+ [ $chan ] ] 1
    if (%repeat.counter. [ $+ [ $chan ] ] == 6) {
      plusm $chan
    }
    elseif (%repeat.counter. [ $+ [ $chan ] ] == 7) {
      mkb $chan %fsn $nick | unset %fsn*
    }
    elseif (%repeat.counter. [ $+ [ $chan ] ] == 15) {
      plusr $chan
      mkb $chan $nick
    }
    elseif (%repeat.counter. [ $+ [ $chan ] ] > 7) {
      mkb $chan $nick
    }
  }
  hadd -m text.floodpro $chan $1-
}
 
on @*:part:#:{
  if (exempt isin $level($fulladdress)) halt
  hadd -mu30 floodbanmask $nick $address($nick,2)
  if ($hget($chan,joined $+ . $+ $nick)) {
    inc -u5 %revolving.door.floodpro. [ $+ [ $chan ] ] 1
  }
  if ($hget(text.floodpro, $chan) == $1-) {
    fsn $nick
    inc -u15 %repeat.counter. [ $+ [ $chan ] ] 1
    if (%repeat.counter. [ $+ [ $chan ] ] == 6) {
      plusm $chan
    }
    elseif (%repeat.counter. [ $+ [ $chan ] ] == 7) {
      mb $chan %fsn $nick | unset %fsn*
    }
    elseif (%repeat.counter. [ $+ [ $chan ] ] == 15) {
      plusr $chan
      mb $chan $nick
    }
    elseif (%repeat.counter. [ $+ [ $chan ] ] > 7) {
      mb $chan $nick
    }
  }
  elseif (%revolving.door.floodpro. [ $+ [ $chan ] ] == 10) {
    plusmr $chan
    mb $chan $nick
  }
  elseif (%revolving.door.floodpro. [ $+ [ $chan ] ] > 10) {
    mb $chan $nick
  }
  if ($1) { hadd -m text.floodpro $chan $1- }
}
 
ctcp *:*:#:{
  if ($me isop $chan) {
    if (exempt isin $level($fulladdress)) halt
    inc -u30 %repeat.counter.ctcp. [ $+ [ $chan ] ] 1
    if (%repeat.counter.ctcp. [ $+ [ $chan ] ] == 6) {
      plusm $chan
    }
    elseif (%repeat.counter.ctcp. [ $+ [ $chan ] ] == 7) {
      mkb $chan %fsn $nick | unset %fsn*
    }
    elseif (%repeat.counter.ctcp. [ $+ [ $chan ] ] == 15) {
      plusr $chan
      mkb $chan $nick
    }
    elseif (%repeat.counter.ctcp. [ $+ [ $chan ] ] > 7) {
      mkb $chan $nick
    }
  }
}

 

Link to comment
Share on other sites



×
×
  • Create New...