mIRC Homepage
Posted By: Zedrick Flood Control - 17/06/06 10:36 PM
I am looking for something that can handle these sorts of floods.

floods that load multiple connections on all sorts of addresses to bypass the normal clone ban and to bypass the normal flood control of 5 lines in 4 seconds for example and to bypass the Channel Limit control by loading 1 at a time for the flood.


*** 1 connection join - flood (1 line) - part or quit -- then another connection comes in on a different address to flood with 1 line and then parts or quits and then another connection comes in and another and another to do a big flood.


*** 1 connection join - part or quit -- then another connection on a different address join - part or quit.



to set modes on the room to stop these floods and set yourself on ignore in case of msg flood.

*** when a netsplit happens to stop the modes coming on ***
Posted By: MikeChat Re: Flood Control - 18/06/06 12:34 AM
you can set the channel mode to moderate and voice those who are regulars but arent ops

you can set a channel key and give it to channel regulars, this is easier to work with than setting the channel invite only

as far as not seeing the servermode after a netsplit you can set events to show in status, not channel, or you cant try on servermode with a haltdef (I dont know if it will work, not testing it)
Posted By: Zedrick Re: Flood Control - 18/06/06 12:50 AM
what I am looking for is something to add to the bot that sets modes on the room when these floods happen.
Posted By: OrionsBelt Re: Flood Control - 18/06/06 03:30 AM
Try this Thread

Genius_at_work made a very good script for that.
I've been using it also for a while, and works like charm.
Posted By: genius_at_work Re: Flood Control - 18/06/06 04:12 AM
The code that OrionsBelt linked to should work for you. I totally forgot that I made that code.. so I pulled up a more elaborate code that protects against more than just text floods. It is considerably longer, and since I originally designed it to protect a single channel, it is NOT multi-channel compatible.

Code:
/*
### ### ### ### ### ### ### ### ### ### ###
### ### ### ### ### ### ### ### ### ### ###
###                                     ###
### "Protect Script" by genius_at_work  ###
###                                     ###
### ### ### ### ### ### ### ### ### ### ###
### ### ### ### ### ### ### ### ### ### ###
*/

alias protchan return [color:red]#channel_name[/color]

on *:START:protect.load
on *:CONNECT:.timer 1 20 protect.reset
on *:JOIN:$($protchan):protect.join $1-
on *:NICK:protect.nick $1-
on *:TEXT:*:$($protchan):protect.text $1-
on *:ACTION:*:$($protchan):protect.text $1-
on *:NOTICE:*:$($protchan):protect.text $1-
on *:PART:*:protect.part $nick
on *:KICK:*:protect.part $knick
on *:QUIT:protect.part $nick

alias protect.load {
  echo 3 -st Startup: Loaded protection values

  [color:blue]set %join.maxtotal 12
  set %join.maxaddress 5
  set %join.maxnick 3
  set %nick.maxtotal 5
  set %nick.maxaddress 3
  set %nick.maxlength 20
  set %text.maxrepeat 5
  set %text.maxscroll 10
  set %text.maxchars 1000
  set %mass.maxscroll 30
  set %mass.maxchars 3000
  set %spec.maxchars 200
  set %spec.maxcharsline 75
  set %spam.lines 3
  set %spam.regex /(http|\.com|\.net|\.org|\.php|\.html)/i
  set %rant.length 200
  set %prot.ignore [color:red]list,of,nicks,here[/color]

  set %time.unban 8m
  set %time.allclear 5m[/color]

  if (*m iswm %time.unban) %time.unban = $calc($remove(%time.unban,m) * 60)
  if (*m iswm %time.allclear) %time.allclear = $calc($remove(%time.allclear,m) * 60)

  protect.reset
}

alias protect.reset {
  if ($hget(protect)) hdel -w protect *
}

alias protect.send {
  [color:green]notice $+(@,$protchan) $1-[/color]
}

alias protect.join {
  if ($prot.ignore($nick)) return
  if ($nick isop $protchan) return
  if ($nick == $me) return
  if ($me !isop $protchan) { .msg chanserv op $protchan $me | return }
  if (!%protect.en) return

  if (!$hget(protect)) hmake protect 5
  var %address = $address($nick,2)

  if ($hget(protect,$+(spam~,$nick)) == $null) hadd -u300 protect $+(spam~,$nick) %spam.lines

  hinc -u10 protect join.~
  if ($hget(protect,join.~) > %join.maxtotal) {
    if (!$hget(protect,join.wait.~)) {
      Protect.Send Mass Join Flood Detected
      lockdown
      if (%time.allclear > 0) .timer 1 %time.allclear allclear
      hadd -u8 protect join.wait.~ 1
    }
  }

  hinc -u10 protect $+(join.a.,%address)
  if ($hget(protect,$+(join.a.,%address)) > %join.maxaddress) {
    if (!$hget(protect,$+(join.wait.,%address))) {
      Protect.Send Join Flood Detected from %address
      mode $protchan +b %address
      if (%time.unban > 0) $+(.timer.unban.,%address) 1 %time.unban mode $protchan -b %address
      hadd -u8 protect $+(join.wait.,%address) 1
    }
  }

  hinc -u15 protect $+(join.,$nick)
  if ($hget(protect,$+(join.,$nick)) > %join.maxnick) {
    if (!$hget(protect,$+(join.wait.,$nick))) {
      Protect.Send Join Flood Detected from $nick ( $+ %address $+ )
      mode $protchan +b %address
      if (%time.unban > 0) $+(.timer.unban.,%address) 1 %time.unban mode $protchan -b %address
      hadd -u8 protect $+(join.wait.,$nick) 1
    }
  } 

  if ($len($nick) > %nick.maxlength) {
    Protect.Send Excessive Nick Length from $nick ( $+ %address $+ )
    mode $protchan +b $+($nick,!*@*)
    kick $protchan $nick Excessive Nickname Length. Max: %nick.maxlength
    if (%time.unban > 0) $+(.timer.unban.nick.,$nick) 1 %time.unban mode $protchan -b $+($nick,!*@*)
  }
}


alias protect.part {
  ;*** $1=nick
  if ($1 == $me) return
  if (!%protect.en) return

  if ($hget(protect,$+(spam~,$1)) != $null) hdel protect $+(spam~,$1)

}

alias protect.nick {
  if ($prot.ignore($nick)) return
  if ($nick isop $protchan) return
  if ($nick == $me) return
  if ($me !isop $protchan) { .msg chanserv op $protchan $me | return }
  if (!%protect.en) return

  if (!$hget(protect)) hmake protect 5

  hinc -u5 protect nick.~
  if ($hget(protect,nick.~) > %nick.maxtotal) {
    if (!$hget(protect,nick.wait.~)) {
      Protect.Send Mass Nick Change Flood Detected
      lockdown
      if (%time.allclear > 0) .timer 1 %time.allclear allclear
      hadd -u5 protect nick.wait.~ 1
    }
  }

  var %address = $address($newnick,2)
  hinc -u8 protect $+(nick.a.,%address)
  if ($hget(protect,$+(nick.a.,%address)) > %nick.maxaddress) {
    if (!$hget(protect,$+(nick.wait.,%address))) {
      Protect.Send Nick Change Flood Detected from %address
      mode $protchan +b %address
      if (%time.unban > 0) $+(.timer.unban.,%address) 1 %time.unban mode $protchan -b %address
      hadd -u5 protect $+(nick.wait.,%address) 1
    }
  }

  if ($len($newnick) > %nick.maxlength) {
    Protect.Send Excessive Nick Length from $newnick ( $+ %address $+ )
    mode $protchan +b $+($newnick,!*@*)
    kick $protchan $newnick Excessive Nickname Length. Max: %nick.maxlength
    if (%time.unban > 0) $+(.timer.unban.nick.,$newnick) 1 %time.unban mode $protchan -b $+($newnick,!*@*)
  }
}


alias protect.text {
  if ($prot.ignore($nick)) return
  if ($nick isop $protchan) return
  if ($nick == $me) return
  if ($me !isop $protchan) { .msg chanserv op $protchan $me | return }
  if (!%protect.en) return


  if (!$hget(protect)) hmake protect 5
  var %address = $address($nick,2)


  var %jsaddress = $address($nick,2)
  if (%jsaddress == $null) %jsaddress = $nick $+ !*@*

  if ($hget(protect,$+(spam~,$nick)) > 0) {
    if ((%spam.regex != $null) && ($regex(js,$1-,%spam.regex))) {
      mode $chan +b %jsaddress
      set -u10 %prot.kicked 1
      kick $chan $nick Spamming is not allowed on $protchan
    }
    elseif ((%rant.length > 0) && ($len($1-) > %rant.length)) {
      mode $chan +b %jsaddress
      set -u10 %prot.kicked 1
      kick $chan $nick Ranting is not allowed on $protchan
      $+(.timer.rant.,$nick) 1 300 mode $chan -b %js.address
    }
    else {
      hdec -u300 protect $+(spam~,$nick) 1
    }
  }

  if ($hget(protect,$+(spam~,$nick)) <= 0) {
    hdel protect $+(spam~,$nick)
  }

  var %last.time = $hget(protect,text.time.~)
  if (!%last.time) {
    hadd -u5 protect text.time.~ 1
    hadd -u5 protect text.lines.~ 0
    hadd -u5 protect text.chars.~ 0
  }
  else {
    hinc -u5 protect text.lines.~
    hinc -u5 protect text.chars.~ $len($1-)
  }

  var %mass.lines = $hget(protect,text.lines.~)
  var %mass.chars = $hget(protect,text.chars.~)

  var %mreason
  if (%mass.lines > %mass.maxscroll) %mreason = Text Scroll
  elseif (%mass.chars > %mass.maxchars) %mreason = Text Flood

  if (%mreason != $null) {
    if (!$hget(protect,text.waits.~)) {
      Protect.Send Mass %mreason Detected
      lockdown
      if (%time.allclear > 0) .timer 1 %time.allclear allclear
      hadd -u3 protect text.waits.~ 1
    }
  }

  ;###

  var %last.said = $hget(protect,$+(text.said.,$nick))
  if ($1- != %last.said) {
    hadd -u5 protect $+(text.said.,$nick) $1-
    hadd -u5 protect $+(text.reps.,$nick) 1
  }
  else {
    hadd -u5 protect $+(text.said.,$nick) $1-
    hinc -u5 protect $+(text.reps.,$nick)
  }

  var %last.time = $hget(protect,$+(text.time.,$nick))
  if (!%last.time) {
    hadd -u5 protect $+(text.time.,$nick) 1
    hadd -u5 protect $+(text.lines.,$nick) 1
    hadd -u5 protect $+(text.chars.,$nick) $len($1-)
    hadd -u5 protect $+(spec.chars.,$nick) $count($1-,,,,)
  }
  else {
    hinc -u5 protect $+(text.lines.,$nick)
    hinc -u5 protect $+(text.chars.,$nick) $len($1-)
    hinc -u5 protect $+(spec.chars.,$nick) $count($1-,,,,)
  }

  var %text.reps = $hget(protect,$+(text.reps.,$nick))
  var %text.lines = $hget(protect,$+(text.lines.,$nick))
  var %text.chars = $hget(protect,$+(text.chars.,$nick))
  var %spec.chars = $hget(protect,$+(spec.chars.,$nick))
  var %spec.charsline = $count($1-,,,,)

  var %kreason
  if (%text.reps > %text.maxrepeat) %kreason = Text Repeat
  elseif (%text.lines > %text.maxscroll) %kreason = Text Scroll
  elseif (%text.chars > %text.maxchars) %kreason = Text Flood
  elseif (%spec.chars > %spec.maxchars) %kreason = Attribute Flood
  elseif (%spec.charsline > %spec.maxcharsline) %kreason = Attribute Abuse

  if (%kreason != $null) {

    if (!$hget(protect,$+(text.waits.,$nick))) {
      Protect.Send %kreason Detected from $nick ( $+ %address $+ )
      hadd -u4 protect $+(text.waits.,$nick) 1
    }

    hinc -u180 protect $+(text.offs.,$nick)

    var %text.offs = $hget(protect,$+(text.offs.,$nick))
    if (%text.offs == 1) {
      set -u10 %prot.kicked 1 
      kick $protchan $nick %kreason
    }
    if (%text.offs > 3) { 
      if (!$hget(protect,$+(text.waitb.,$nick))) {

        mode $protchan +b %address 
        if (%time.unban > 0) $+(.timer.unban.,%address) 1 %time.unban mode $protchan -b %address
        set -u10 %prot.kicked 1
        .timer -m 1 200 kick $protchan $nick %kreason

        hadd -u5 protect $+(text.waitb.,$nick) 1
      }
    }
    if (%text.offs > 8) {
      $+(.timer.unban.,%address) off 
    }
  }
}

alias protect {
  if (!$1) {
    notice $nick Protection status: $iif(%protect.en,Enabled,Disabled)
    notice $nick Syntax: /protect <on/off/reset/reload>
    return
  }
  if ($1 == on) {
    notice $nick Protection is now Enabled
    %protect.en = $true
    return
  }
  if ($1 == off) {
    notice $nick Protection is now Disabled
    %protect.en = $false
    return
  }
  if ($1 == reset) {
    notice $nick Protection has been reset
    protect.reset
    return
  }
  if ($1 == reload) {
    notice $nick Protection settings have been reloaded
    protect.load
    return
  }
}

alias -l lockdown {
  var %chan = $protchan

  if (%LD.chan == %chan) return

  ; Enabled -> (x && 1)
  if ($me !isop %chan && 1) {
    msg chanserv OP $protchan $me
    return
  }

  set %LD.chan %chan

  msg $protchan %chan has been placed in SECURE MODE

  mode %chan +mitnRN
}

alias -l allclear {
  var %chan = $protchan

  if (%LD.chan != %chan) return

  ; Enabled -> (x && 1)
  if ($me !isop %chan && 1) {
    msg chanserv OP $protchan $me
    return
  }

  msg $protchan %chan has been returned to NORMAL MODE

  mode %chan -miRN

  unset %LD.chan
}


Note: I had to modify this code to work without the rest of the script files that are present in my bot. It is untested, so there are bound to be a few small bugs due to my missing changing some identifier.

You can alter the blue portions to change how sensitive the protection is.

You must alter the red portions to the correct information for your channel ($protchan) and exempt users (%prot.ignore).

You can alter the green portions to specify where you want the reported information to go. For example, if you had a private admin channel, you could add this line: msg #adminchan $1-

If you have any problems or questions, post them here.

-genius_at_work
Posted By: Zedrick Re: Flood Control - 18/06/06 07:15 AM
Thank You OrionsBelt - that might work for the join - flood (1 line) - part or quit


*** 1 connection join - part or quit -- then another connection on a different address join - part or quit.


is there anything for this one ?
when a netsplit happens to not set the modes
Posted By: OrionsBelt Re: Flood Control - 30/08/06 06:12 PM
Genius,

Since a couple of days, I have been using this protection script. It seems to work quite nicely, and didn't find any problems yet.

Just one idea / suggestion.
Last night, there was a netsplit.
When the netsplit was 'solved' all the people returned again, and the script detected a join-flood.
Which is actually what it is supposed to detect.

Isn't there a way to make this script smarter? So, that it will see that the join-flood was due to a netsplit?

Any idea's?
If not, I still love the script, it's just an idea laugh

Thx
Posted By: genius_at_work Re: Flood Control - 31/08/06 03:05 AM
On my server, net-merges usually happen so quickly that the script doesn't have time to actually ban anyone from the channel or lock it down before everyone has rejoined. Unless there is some message on your server that indicates when a net split/merge has occurred, I can't think of any reliable way to determine that a netsplit has occurred.

-genius_at_work
Posted By: RusselB Re: Flood Control - 31/08/06 03:31 AM
I don't know if this'll help or not, but on the network where I have IRCops, when there is a netsplit, I see an snotice like this
Quote:
[15:54:23] -EagleOne.Maximum-IRC.com- *** Global -- from Hub.Maximum-IRC.com: No response from Darkside.Maximum-IRC.com[216.86.156.111], closing link
Posted By: OrionsBelt Re: Flood Control - 31/08/06 05:03 AM
No, the only thing I get to see is:
=02:06:57= * Nickname (blah@blah.blah.com) Quit (*.net *.split)

That times 50, since there are like 100 people on the chan I protect.
And later on, in this case it was 5 minutes, they all join again.

No snotice I think...
© mIRC Discussion Forums