Channel Flood Protection.

By Ghost-writer on Nov 29, 2009

Yes, i know its a lot for a flood protection, but i made it so it would be appealing to your eyes, i hope it did its job, comments accepted always room for improvement.

on $*:text:*:#: {
  if ($hget(protection, flood) == on) {
    if ($hget($network $+ pro, $chan)) {
      if (!$hget(prolist, $nick)) {
        if ($nick isop $chan) && ($hget(protection, op) == on) halt 
        if ($nick ishop $chan) && ($hget(protection, hop) == on) halt 
        if ($nick isvoice $chan) && ($hget(protection, voice) == on) halt 
        if (!$hget(protection, klines)) hadd protection klines 3
        if (!$hget(protection, ksecs)) hadd protection ksecs 3
        if (!$hget(Flood $+ $network)) hmake Flood $+ $network 
        hinc flood $+ $network $nick
        .timer $+ $nick 1 $hget(protection, ksecs) hdel Flood $+ $network $nick *
        if ($hget(flood $+ $network , $+ $nick) >= $hget(protection, klines)) {
          if ($hget(flood $+ $network $+ ,Warning $+ $nick) >= 3) { mode $chan +b $address($nick,3) | hdel Flood $+ $network warning $+ $nick * }
          hinc Flood $+ $network Warning $+ $nick
          kick $chan $nick 12«14 (12Flood Protection - $hget(protection, klines) lines in $hget(protection, ksecs) seconds 14) 12»
        }
      }
    }
  }
}
alias FC {
  dialog -mo fc fc
}
alias FCs {
  dialog -mo fcs fcs
}
alias fch {
  echo -a 12«14 (12Flood Control Script14) 12»
  echo -a 12«14 (12To turn on the flood control, select on in the flood settings dialog.14) 12»
  echo -a 12«14 (12Your automatic flood is set to 3 lines in 5 seconds14) 12»
  echo -a 12«14 (12For more help / bugs seen, go to - Irc.swiftirc.net -j #darkness and speak with Atom or Andrew|14) 12»
}
menu c* {
  Flood Control.
  .Help:fch
  .Channel Menu:FC
  .Flood Settings:FCS
}
dialog FCs {
  title "Flood Control - Settings - Termz-@-2009"
  size -1 -1 190 200
  option dbu
  edit "", 1, 5 25 177 12, autohs
  radio "Flood Control on", 2, 5 130 50 24, left
  radio "Flood Control off", 3, 120 130 50 24, left
  button  "lines before kicking", 4, 4 45 90 24,
  button  "seconds before unsetting", 5, 94 45 90 24,
  button  "Add kick exception", 6, 4 69 90 24,
  button  "Remove kick exception",7, 94 69 90 24,
  list  8, 5 7 177 14, vsbar size
  list  9, 5 105 180 30, vsbar size
  text  "Do not kick these people",13, 60 160 90 24,
  check "Ops - @", 10, 5 170 50 24, left
  check "Half ops - %", 11, 65 170 50 24, left
  check "Voices - +", 12, 125 170 50 24, left
}
on *:dialog:fcs:init:*: {
  if (!$hget(prolist)) hmake prolist 5
  if ($read(prolist.txt)) .hload prolist Prolist.txt
  did -ra $dname 9 Protection list
  prolist
  check
  did -ra $dname 8 $iif($hget(protection, flood) == off,Flood control has been turned off,A person will be kicked after $iif($hget(protection, klines),$v1,3) lines in $iif($hget(protection, ksecs),$v1,5) seconds!)
}
alias check {
  did -c fcs $iif($hget(protection, flood) == on,2,3)
  if ($hget(protection, hop) == on) did -c fcs 11
  if ($hget(protection, op) == on) did -c fcs 10
  if ($hget(protection, Voices) == on) did -c fcs 12
}
on *:dialog:fcs:sclick:*: {
  if ($did == 2) {
    hadd Protection Flood on
    did -ra $dname 8 A person will now be kicked after $iif($hget(protection, klines),$v1,3) lines in $iif($hget(protection, ksecs),$v1,5) seconds!
  }
  if ($hget(protection, flood) == on) {
    if ($did == 12) hadd protection Voices $iif($hget(protection, Voices) == on,off,on)
    if ($did == 11) hadd protection Hop $iif($hget(protection, Hop) == on,off,on)
    if ($did == 10) hadd protection op $iif($hget(protection, op) == on,off,on)
    if ($did == 3) {
      hadd Protection Flood off
      did -ra $dname 8 Flood control has been turned off
    }
    if ($did == 9) set %result $did(9).seltext
    if ($did == 7) { 
      if (%result) {
        if ($chr(32) !isin %result) {
          did -ra $dname 8 %result has been deleted from the exceptions list!
          hdel prolist %result protected
          unset %result
          did -ra $dname 9 Protection list
          prolist
        }
        else error You cannot delete this!
      }
      else error You have not chosen anyone!
    }
    if ($did == 6) {
      if ($len($did(1).text) >= 1) && ($did(1).text !isnum) {
        if ($chr(32) !isin $did(1).text) {
          if (!$hget(prolist)) hmake prolist 5
          hadd Prolist $did(1).text Protected
          hsave prolist Prolist.txt
          did -ra $dname 9 Protection list
          prolist
        }
        else error No spaces allowed, add all nicks seperetly
      }
      else error You must input a name that is not a number, No wildcards - just nicks.
    }
    if ($did == 4) {
      if ($did(1).text isnum) && ($did(1).text > 0) {
        hadd protection Klines $did(1).text
        did -ra $dname 8 A person will now be kicked after $hget(protection, klines) lines in $iif($hget(protection, ksecs),$v1,5) seconds!
      }
      else error You must input a number above 0 into the box!
    }
    if ($did == 5) {
      if ($did(1).text isnum) && ($did(1).text > 0) {
        hadd protection ksecs $did(1).text
        did -ra $dname 8 A person will now be kicked after $iif($hget(protection, klines),$v1,3) lines in $iif($hget(protection, ksecs),$v1,5) seconds!
      }
      else error You must input a number above 0 into the box!
    }
  }
  else error Your flood protection is not on!
}
dialog FC {
  title "Flood Control - Channel Menu - Termz-@-2009"
  size -1 -1 190 150
  option dbu
  text  "Channel you want to add", 5, 58 16 90 24, nowrap
  text  "Channels you are protecting, To remove click one.", 6, 33 66 120 54, nowrap
  button  "Add Channel To Flood Control", 2, 4 37 90 24,
  button  "Remove Channel From Flood Control", 3, 94 37 90 24,
  edit "", 1, 5 25 177 12, autohs
  list  4, 5 75 180 64, vsbar size
}
alias ViewCh {
  if ($read(protection.txt)) hload protection protection.txt
  if ($read($network $+ .txt)) hload $network $+ pro $network $+ .txt
  var %x $hget(protection, 0).item
  while (%x) {
    var %b $hget(protection, %x).item
    if (pro isin %b) {
      did -a fc 4 $remove($hget(protection, %x).item,pro)
      var %y $hget(%b, 0).item 
      while (%y) {
        if ($hget(%b,%y).item != $remove($hget(Protection, %x).item,pro)) {
          did -a fc 4 $hget(%b, %y).item 
        }
        Dec %y 
      }
    }
    dec %x
  }
}
alias savech {
  hsave $network $+ Pro $network $+ .txt
  hsave Protection Protection.txt
  unset %remove
}
on *:dialog:Fc:init:*: viewch
on *:dialog:Fc:close:*: savech
on *:dialog:Fc:sclick:*: {
  if ($did == 2) {
    if ($left($did(1).text,1) == $chr(35)) {
      if (!$hget($network $+ Pro, $did(1).text)) {
        did -a $dname 4 $did(1).text
        if (!$hget( $+  $network $+ Pro, 0).item) { hmake $network $+ Pro 5 | hadd $network $+ Pro $network }
        if (!$hget(protection, 0).item) hmake protection 25
        if ($read(pro.txt)) hload protection pro.txt
        hadd $network $+ Pro $did(1).text Protected
        Hadd Protection $network $+ Pro $did(1).text $network
        did -r $dname 4
        viewch
      }
      error This channel is already on the list!
    }
    else error You must input a channel to add
  }
  if ($did == 4) set %remove $did(4).seltext
  if ($did == 3) {
    if (%remove) {
      if ($network != %remove) {
        did -r $dname 4
        hdel $prowork(%remove) %remove protected
        viewch
      }
      else error You cannot remove a server from protection!
    }
    else error You have not clicked a channel to remove!
  }
}
alias prowork {
  var %x $hget(protection, 0).item
  while (%x) {
    if ($hget($hget($hget(protection, %x).item), $1)) return $hget(protection, %x).item
    dec %x
  }
}
alias error {
  noop $tip(Flood Control,Error, $1- $+ ,10)
}
alias prolist {
  var %x $hget(prolist, 0).item
  while (%x) {
    did -a fcs 9 $hget(prolist, %x).item
    dec %x
  }
}
Sign in to comment.
PyThOn   -  Jul 07, 2011

Doesn't work for me. Lmfao @ This

 Respond  
morfina   -  Feb 24, 2010

I have a problem:

  • /hadd: no such table 'Protection' (line 74, script25.ini)
 Respond  
Cheiron   -  Dec 18, 2009

if you are on a unrealircd with anope .. you can set a room mode that may help.. it is mode j an example would be something like /mode #channel +j 1:3 that is a part/join protection mode where x is the number of joins and y is the number of seconds. also set a flood mode eg /mode #channel +f [5j#R2]5 that would be 5 joins in 5 secs to tigger mode R (registered users only may join) for 2 mins. mode j is per user.. mode f is global. between the 2 of them you should be able to protect against botnets but like i say that is purely for unrealircds

 Respond  
AYEHAN   -  Dec 18, 2009

will it work for botnet flood? or say flood from multiple ip

 Respond  
DarkCoder   -  Dec 14, 2009

Its good :P.

 Respond  
Cracker200   -  Nov 29, 2009

LOL @

  dialog FC {
  title "Flood Control - Channel Menu - Termz-@-2009"
  size -1 -1 190 150

And Nice, Coding.

 Respond  
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.