daily pastebin goal
87%
SHARE
TWEET

Channel Botnet Flood Protection

Seb Feb 7th, 2012 (edited) 474 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Channel Botnet Flood Protection
  2. ; Author : SeeknDestroy (sanitarium) [sanitarium-@-mircscripting.info]
  3. ; Release Date : October 21st, 2006
  4.  
  5.  
  6. alias ialscan {
  7.   return $ialchan($$2,$$1,0)
  8. }
  9.  
  10. alias ialnicks {
  11.   var %i = 1
  12.   var %z = $ialscan($$1,$$2)
  13.   var %ns = $null
  14.   while (%i <= %z) {
  15.     var %n = $ialchan($$2,$$1,%i).nick
  16.     var %ns = $addtok(%ns,%n,32)
  17.     inc %i 1
  18.   }
  19.   return %ns
  20. }
  21.  
  22. alias ialkick {
  23.   var %ii = 1
  24.   var %zz = $ialscan($$1,$$2)
  25.   var %ns = $ialnicks($$1,$$2)
  26.   var %nm = $iif($3,$3-,Clones from $$2)
  27.   while (%ii <= %zz) {
  28.     var %n = $gettok(%ns,%ii,32)
  29.     kick $$1 %n %nm
  30.     inc %ii 1
  31.   }
  32. }
  33.  
  34. ; [m]ass[k]ick[b]an
  35. ; usage : /mkb #chan nick1 nick2 nick3 ...
  36. alias mkb {
  37.   mb $1-
  38.   mk $1-
  39. }
  40.  
  41. ; [m]ass[b]an alias
  42. ; usage : /mb #chan nick1 nick2 nick3 ...
  43. alias mb {
  44.   if (%mb.chan) {
  45.     if (%mb.chan != $$1) {
  46.       mode %mb.chan + $+ $str(b,$numtok(%mb.masks,32)) %mb.masks
  47.       unset %mb.masks
  48.     }
  49.   }
  50.   set -u10 %mb.chan $$1
  51.   tokenize 32 $2-
  52.   while ($1) {
  53.     var %x = 1
  54.     var %mb.ibl.total = $ibl(%mb.chan,0)
  55.     var %mb.ibl.check = 0
  56.     var %mb.ibl.address = $iif($address($1,2),$address($1,2),$hget(floodbanmask,$1))
  57.     while (%x <= %mb.ibl.total) {
  58.       if ($ibl(%mb.chan,%x) == %mb.ibl.address) {
  59.         %mb.ibl.check = 1
  60.       }
  61.       inc %x 1
  62.     }
  63.     if (!%mb.ibl.check) {
  64.       set %mb.masks $addtok(%mb.masks,%mb.ibl.address,32)
  65.     }
  66.     tokenize 32 $2-
  67.     if ($numtok(%mb.masks,32) == 6) {
  68.       mode %mb.chan + $+ $str(b,$numtok(%mb.masks,32)) %mb.masks
  69.       .timermbban off
  70.       unset %mb.masks
  71.     }
  72.   }
  73.   if (%mb.masks) {
  74.     .timermbban 1 1 mode %mb.chan + $+ $str(b,$numtok(%mb.masks,32)) %mb.masks
  75.     .timermbban2 1 1 unset %mb.masks
  76.   }
  77. }
  78.  
  79. ; [m]ass[k]ick alias
  80. ; usage : /mk #chan nick1 nick2 nick3 ...
  81. alias mk {
  82.   var %mk.chan = $$1
  83.   tokenize 32 $2-
  84.   while ($1) {
  85.     if (!$timer(mk. [ $+ [ $1 ] ])) {
  86.       inc -u10 %mk 5
  87.       .timermk. [ $+ [ $1 ] ] 1 %mk mk2 %mk.chan $1
  88.     }
  89.     tokenize 32 $2-
  90.   }
  91. }
  92.  
  93. ; since /mk starts a timer, /mk2 checks to see if they're
  94. ; still there before kicking when kick timer(s) trigger(s)
  95. alias mk2 {
  96.   if ($2 ison $1) {
  97.     inc -u30 %mktotal 1
  98.     ialkick $1 $address($2,2) %mktotal
  99.   }
  100. }
  101.  
  102. on shitlist:join:#:{
  103.   mkb $chan $nick
  104. }
  105.  
  106. alias autoshit {
  107.   set -u60 %auto.shitlist. [ $+ [ $$1 ] ] 1
  108.   msg $$1 Auto-Shitlisting anyone joining for the next 60 seconds
  109. }
  110.  
  111. alias plusm {
  112.   if ($network == dalnet) { var %mode.m = M }
  113.   else { var %mode.m = m }
  114.   mode $$1 + $+ %mode.m
  115.   .timerminusr [ $+ [ $chan ] ] 1 120 mode $$1 - $+ %mode.m
  116. }
  117.  
  118. alias plusr {
  119.   if ($network == dalnet) { var %mode.r = R }
  120.   else { var %mode.r = r }
  121.   mode $$1 + $+ %mode.r
  122.   .timerminusr [ $+ [ $chan ] ] 1 120 mode $$1 - $+ %mode.r
  123. }
  124.  
  125. alias plusmr {
  126.   if ($network == dalnet) { var %mode.mr = MR }
  127.   else { var %mode.mr = mr }
  128.   mode $$1 + $+ %mode.mr
  129.   .timerminusmr [ $+ [ $chan ] ] 1 120 mode $$1 - $+ %mode.mr
  130. }
  131.  
  132. ; (F)lood (S)hift (N)icks
  133. alias fsn {
  134.   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
  135.   set %fsn %fsn.7 %fsn.6 %fsn.5 %fsn.4 %fsn.3 %fsn.2 %fsn.1
  136.   .timerunsetfsn 1 15 unset %fsn*
  137. }
  138.  
  139.  
  140. on @*:join:#:{
  141.   hadd -mu15 $chan joined $+ . $+ $nick 1
  142.   if (%auto.shitlist. [ $+ [ $chan ] ] == 1) {
  143.     auser shitlist $address($nick,2)
  144.     mkb $chan $nick
  145.   }
  146.   elseif ($regex($nick,/\d\d\d/)) {
  147.     fsn $nick
  148.     inc -u15 %random.nick. [ $+ [ $chan ] ] 1
  149.     if (%random.nick. [ $+ [ $chan ] ] == 6) {
  150.       plusm $chan
  151.     }
  152.     elseif (%random.nick. [ $+ [ $chan ] ] == 7) {
  153.       mkb $chan %fsn $nick | unset %fsn*
  154.     }
  155.     elseif (%random.nick. [ $+ [ $chan ] ] == 15) {
  156.       plusr $chan
  157.       mkb $chan $nick
  158.     }
  159.     elseif (%random.nick. [ $+ [ $chan ] ] > 7) {
  160.       mkb $chan $nick
  161.     }
  162.   }
  163.   else {
  164.     if (%clone.flood. [ $+ [ $chan ] $+ [ $site ] ]) {
  165.       fsn $nick
  166.       inc -u30 %clone.flood. [ $+ [ $chan ] ] 1
  167.       if (%clone.flood. [ $+ [ $chan ] ] == 6) {
  168.         plusm $chan
  169.       }
  170.       elseif (%clone.flood. [ $+ [ $chan ] ] == 7) {
  171.         mkb $chan %fsn $nick
  172.       }
  173.       elseif (%clone.flood. [ $+ [ $chan ] ] == 15) {
  174.         plusr $chan
  175.         mkb $chan $nick
  176.       }
  177.       elseif (%clone.flood. [ $+ [ $chan ] ] > 3) {
  178.         mkb $chan $nick
  179.       }
  180.     }
  181.     inc -u30 %clone.flood. [ $+ [ $chan ] $+ [ $site ] ] 1
  182.   }
  183. }
  184.  
  185. on @*:text:*:#:{
  186.   if (($nick isop $chan) || (exempt isin $level($fulladdress))) halt
  187.   if ($hget(text.floodpro, $chan) == $1-) {
  188.     fsn $nick
  189.     inc -u15 %repeat.counter. [ $+ [ $chan ] ] 1
  190.     if (%repeat.counter. [ $+ [ $chan ] ] == 6) {
  191.       plusm $chan
  192.     }
  193.     elseif (%repeat.counter. [ $+ [ $chan ] ] == 7) {
  194.       mkb $chan %fsn $nick | unset %fsn*
  195.     }
  196.     elseif (%repeat.counter. [ $+ [ $chan ] ] == 15) {
  197.       plusr $chan
  198.       mkb $chan $nick
  199.     }
  200.     elseif (%repeat.counter. [ $+ [ $chan ] ] > 7) {
  201.       mkb $chan $nick
  202.     }
  203.   }
  204.   hadd -m text.floodpro $chan $1-
  205. }
  206.  
  207. on @*:action:*:#:{
  208.   if (($nick isop $chan) || (exempt isin $level($fulladdress))) halt
  209.   if ($hget(text.floodpro, $chan) == $1-) {
  210.     fsn $nick
  211.     inc -u15 %repeat.counter. [ $+ [ $chan ] ] 1
  212.     if (%repeat.counter. [ $+ [ $chan ] ] == 6) {
  213.       plusm $chan
  214.     }
  215.     elseif (%repeat.counter. [ $+ [ $chan ] ] == 7) {
  216.       mkb $chan %fsn $nick | unset %fsn*
  217.     }
  218.     elseif (%repeat.counter. [ $+ [ $chan ] ] == 15) {
  219.       plusr $chan
  220.       mkb $chan $nick
  221.     }
  222.     elseif (%repeat.counter. [ $+ [ $chan ] ] > 7) {
  223.       mkb $chan $nick
  224.     }
  225.   }
  226.   hadd -m text.floodpro $chan $1-
  227. }
  228.  
  229. on @*:notice:*:#:{
  230.   if (($nick isop $chan) || (exempt isin $level($fulladdress))) halt
  231.   if ($hget(text.floodpro, $chan) == $1-) {
  232.     fsn $nick
  233.     inc -u15 %repeat.counter. [ $+ [ $chan ] ] 1
  234.     if (%repeat.counter. [ $+ [ $chan ] ] == 6) {
  235.       plusm $chan
  236.     }
  237.     elseif (%repeat.counter. [ $+ [ $chan ] ] == 7) {
  238.       mkb $chan %fsn $nick | unset %fsn*
  239.     }
  240.     elseif (%repeat.counter. [ $+ [ $chan ] ] == 15) {
  241.       plusr $chan
  242.       mkb $chan $nick
  243.     }
  244.     elseif (%repeat.counter. [ $+ [ $chan ] ] > 7) {
  245.       mkb $chan $nick
  246.     }
  247.   }
  248.   hadd -m text.floodpro $chan $1-
  249. }
  250.  
  251. on @*:part:#:{
  252.   if (exempt isin $level($fulladdress)) halt
  253.   hadd -mu30 floodbanmask $nick $address($nick,2)
  254.   if ($hget($chan,joined $+ . $+ $nick)) {
  255.     inc -u5 %revolving.door.floodpro. [ $+ [ $chan ] ] 1
  256.   }
  257.   if ($hget(text.floodpro, $chan) == $1-) {
  258.     fsn $nick
  259.     inc -u15 %repeat.counter. [ $+ [ $chan ] ] 1
  260.     if (%repeat.counter. [ $+ [ $chan ] ] == 6) {
  261.       plusm $chan
  262.     }
  263.     elseif (%repeat.counter. [ $+ [ $chan ] ] == 7) {
  264.       mb $chan %fsn $nick | unset %fsn*
  265.     }
  266.     elseif (%repeat.counter. [ $+ [ $chan ] ] == 15) {
  267.       plusr $chan
  268.       mb $chan $nick
  269.     }
  270.     elseif (%repeat.counter. [ $+ [ $chan ] ] > 7) {
  271.       mb $chan $nick
  272.     }
  273.   }
  274.   elseif (%revolving.door.floodpro. [ $+ [ $chan ] ] == 10) {
  275.     plusmr $chan
  276.     mb $chan $nick
  277.   }
  278.   elseif (%revolving.door.floodpro. [ $+ [ $chan ] ] > 10) {
  279.     mb $chan $nick
  280.   }
  281.   if ($1) { hadd -m text.floodpro $chan $1- }
  282. }
  283.  
  284. ctcp *:*:#:{
  285.   if ($me isop $chan) {
  286.     if (exempt isin $level($fulladdress)) halt
  287.     inc -u30 %repeat.counter.ctcp. [ $+ [ $chan ] ] 1
  288.     if (%repeat.counter.ctcp. [ $+ [ $chan ] ] == 6) {
  289.       plusm $chan
  290.     }
  291.     elseif (%repeat.counter.ctcp. [ $+ [ $chan ] ] == 7) {
  292.       mkb $chan %fsn $nick | unset %fsn*
  293.     }
  294.     elseif (%repeat.counter.ctcp. [ $+ [ $chan ] ] == 15) {
  295.       plusr $chan
  296.       mkb $chan $nick
  297.     }
  298.     elseif (%repeat.counter.ctcp. [ $+ [ $chan ] ] > 7) {
  299.       mkb $chan $nick
  300.     }
  301.   }
  302. }
RAW Paste Data
Top