mIRC Homepage
Posted By: Awake Slow deop proetection. - 31/08/07 06:46 PM
So there is lots of scripts out there that will rescue a channel if a group of ops suddenly get deopped all at once.

But what about slower ops removal?

Where instead of the person trying to take over going:

/mode # -ooo n1 n2 n3 etc..

They did:

/mode # -o n1
/mode # -o n2
/mode # -o n3 etc..

Mass deop scripts seem to not take this into account, so how would I approach making a small protection script to combat this method?

Any help offered is much appreciated :-)
Posted By: xDaeMoN Re: Slow deop proetection. - 31/08/07 07:51 PM
How long is the interval between each deop?

Try this
Code:
on @!*:DEOP:#: {
    inc $iif(!$($+(%,deopfld,.,$chan,.,$nick),2),-eu10) $+(%,deopfld,.,$chan,.,$nick)
    if ($($+(%,deopfld,.,$chan,.,$nick),2) >= 3) ban -k # $nick 2 Mass DeOp. Go sit in a corner! 
}


^^ will set a variable for that nick who deopped another nick & if they do 3 or more deops within 10 secs, they will be kick-banned. If they have longer intervals, then change the 10 in -eu10, make it higher. Hope that helps.
Posted By: Horstl Re: Slow deop proetection. - 31/08/07 08:37 PM
Just a suggestion - I'd use "random" hash table items instead.
Personally, I dislike timers like "inc -uN" for protections etc, as they were "restarted" on every deop. (likely to named timers: every time they were triggered before they are "done", the unset period is reset. Flood protection scripts etc often have the same issue...) smile

Well, xDaeMoN escaped this source of error, but many scripts dont. frown

This is watching deops in general (disregarding the nick):
Code:
on *:deop:#: {
  var %timeout = 30, %limit = 3
  hadd $+(-mu,%timeout) $+(deop.,$network,.,$chan) $rand(1,999)
  if ($hfind($+(deop.,$network,.,$chan),*,0,w) > %limit) {
    echo -a more than %limit deops in %timeout seconds on $chan detected
  }
}

If you want to detect deops by a single nick, you can add e.g. the nickname as data for the hashtable item, and use $hfind().data:
Code:
on *:deop:#: {
  var %timeout = 30, %limit = 3
  hadd $+(-mu,%timeout) $+(deop.,$network,.,$chan) $rand(1,999) $nick
  if ($hfind($+(deop.,$network,.,$chan),$nick,0,w).data > %limit) {
    echo -a more than %limit deops in %timeout seconds by $nick on $chan detected
  }
}


Edit: if it's not about flood protection (and in this case it's not), $ticks would be as good as a random number for the item name of the hash table.
Posted By: xDaeMoN Re: Slow deop proetection. - 01/09/07 02:54 AM
Yeah, Im aware of using hash tables, but this code is what I've been using on my bot before so I just copy/pasted it. smile
Posted By: Awake Re: Slow deop proetection. - 01/09/07 08:12 AM
Thanks a lot to both of you for the help!

Tis much appreciated :-)

Awake
© mIRC Discussion Forums