View previous topic :: View next topic |
Author |
Message |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3775 Location: Mint Factory
|
Posted: Thu Mar 26, 2015 1:41 am Post subject: |
|
|
SpiKe^^ wrote: | Bummerz, compressing modes implies a queue to wait for enough modes to send. I may be done with this string. |
Actually no, hence the while loop. The server dose the compression for you as long as you send him the correct syntax with all b's and all 15 masks to ban. Since he had pushmode and after it has a putquick then the putquick will get ahead of queue and the pushmode barely gets to send a ban. Will see if this changes after what I've said below.
Quote: |
19:23:41 @simo Sets Mode on #servernet to: +bbbbimbbbbbbbbb *!*@ServerNet-8dr.gjr.196.5.IP *!*@ServerNet-o5fqe1.nj.comcast.net *!*@ServerNet-leu.58j.23.94.IP *!*@ServerNet-bva5s7.res.rr.com *!*@ServerNet-elp.djf.251.148.IP *!*@ServerNet-cu54la.teachlinked.com *!*@ServerNet-9ubjum.il.comcast.net *!*@ServerNet-49ub7e.ri.cox.net *!*@ServerNet-0m0.190.89.81.IP *!*@ServerNet-arm.i2m.208.89.IP *!*@ServerNet-gujkns.shopchristydawn.com *!*@ServerNet-5utjt9.teamcity.cz *!*@ServerNet-f0g0cv.ga.comcast.net
|
From the log you posted I see there needs to be 15 b's in the line to ban 15 hosts at a time, so the only problem i see in the above code is that you switched from puthelp that's a lower queue system to even a lower one, the pushmode.
If you want to quickly deal with all modes at once in one line then switch to putquick too, from:
Code: |
pushmode $chan "+bbbbbbbbbbbbbbb" " [join [lrange $banList 0 15] " "]"
| to: Code: |
putquick "MODE $chan +bbbbbbbbbbbbbbb [join [lrange $banList 0 15] " "]"
|
The lack of action in case of /me is obvious cos it wasn't designed to monitor that too in the first place. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Thu Mar 26, 2015 9:09 pm Post subject: |
|
|
final working script
credits go to:
- spike^^
- speechless
- caesar
thanx guys good job and much apreciated for your works
Code: | # multi-host-repeat.tcl v1.1 by SpiKe^^, closely based on
# repeat.tcl v1.1 (9 April 1999) by slennox <slenny@ozemail.com.au>
# Repeat flood, kick-ban on repeats:seconds #
set rp_bflood 3:10
# Repeat flood kick-ban reason #
set rp_breason "repeat flood"
# Length of time in minutes to ban Repeat flooders #
set rp_btime 1
# After a valid Repeat flood, script will continue to #
# kick-ban offenders for an additional 'x' seconds #
set rp_blinger 10
# END OF SETTINGS # Don't edit below unless you know what you're doing #
bind pubm - * rp_pubmsg
bind notc - * notc_wrap
bind ctcp - "ACTION" action_wrap
proc action_wrap {n u h d k t} { rp_pubmsg $n $u $h $d $t }
proc notc_wrap {n u h t d} { rp_pubmsg $n $u $h $d $t }
set rp_bflood [split $rp_bflood :]
proc rp_pubmsg {nick uhost hand chan text} {
global rp_bcount rp_bflood rp_breason rp_btime rp_blinger
set uhost [string tolower $nick!$uhost]
set chan [string tolower $chan]
set text [string map [list \017 ""] [stripcodes abcgru $text]]
set text [string tolower $text]
if {[isbotnick $nick]} { return 0 }
if {[matchattr $hand f|f $chan]} { return 0 }
set utnow [unixtime]
set target [lindex $rp_bflood 0]
if {[info exists rp_bcount($chan:$text)]} {
set uhlist [lassign $rp_bcount($chan:$text) cnt ut]
set utend [expr {$ut + [lindex $rp_bflood 1]}]
set expire [expr {$utend + $rp_blinger}]
if {$cnt < $target} {
if {$utnow > $utend} { unset rp_bcount($chan:$text) }
} elseif {$utnow > $expire} { unset rp_bcount($chan:$text) }
}
if {![info exists rp_bcount($chan:$text)]} {
set rp_bcount($chan:$text) [list 1 $utnow $uhost]
return 0
}
if {$utnow <= $utend} {
incr cnt
if {[lsearch $uhlist $uhost] == "-1"} { lappend uhlist $uhost }
set rp_bcount($chan:$text) [linsert $uhlist 0 $cnt $ut]
if {$cnt < $target} { return 0 }
if {$cnt == $target} { rp_dobans $chan $uhlist
} else { rp_dobans $chan [list $uhost] }
} elseif {$cnt >= $target} { rp_dobans $chan [list $uhost] }
return 0
}
proc rp_dobans {chan uhlist} {
global rp_breason
if {![botisop $chan]} return
set banList ""
set nickList ""
foreach ele $uhlist {
scan $ele {%[^!]!%[^@]@%s} nick user host
set bmask "*!*@$host"
if {[lsearch $banList $bmask] != -1} continue
lappend banList $bmask
lappend nickList $nick
}
while {[llength $banList] != 0} {
set banList [stack_ban $chan $banList]
}
flushmode $chan
while {[llength $nickList] != 0} {
putquick "KICK $chan [lindex $nickList 0] :$rp_breason" -next
set nickList [lrange $nickList 1 end]
}
}
proc stack_ban {chan banlist} {
if {[llength $banlist] > 5} {
putquick "MODE $chan +bbbbbb [join [lrange $banlist 0 5]]" -next
return [lrange $banlist 6 end]
} elseif {[llength $banlist] > 4} {
putquick "MODE $chan +bbbbb [join [lrange $banlist 0 4]]" -next
return [lrange $banlist 5 end]
} elseif {[llength $banlist] > 3} {
putquick "MODE $chan +bbbb [join [lrange $banlist 0 3]]" -next
return [lrange $banlist 4 end]
} elseif {[llength $banlist] > 2} {
putquick "MODE $chan +bbb [join [lrange $banlist 0 2]]" -next
return [lrange $banlist 3 end]
} elseif {[llength $banlist] > 1} {
putquick "MODE $chan +bb [join [lrange $banlist 0 1]]" -next
return [lrange $banlist 2 end]
} elseif {[llength $banlist]} {
putquick "MODE $chan +b [lindex $banlist 0]" -next
return ""
} else { return "" }
}
proc rp_breset {} {
global rp_bcount rp_bflood rp_blinger
set utnow [unixtime]
set target [lindex $rp_bflood 0]
foreach {key val} [array get rp_bcount] {
lassign $val cnt ut
set utend [expr {$ut + [lindex $rp_bflood 1]}]
set expire [expr {$utend + $rp_blinger}]
if {$cnt < $target} {
if {$utnow > $utend} { unset rp_bcount($key) }
} elseif {$utnow > $expire} { unset rp_bcount($key) }
}
utimer 30 [list rp_breset]
}
if {![info exists rp_running]} {
utimer 30 [list rp_breset]
set rp_running 1
}
putlog "Loaded multi-host-repeat.tcl v1.0 by SpiKe^^"
|
|
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3775 Location: Mint Factory
|
Posted: Fri Mar 27, 2015 1:38 am Post subject: |
|
|
So now it stacks bans, but with the way I said it didn't? Or you didn't quite understood what to change?
Not jealous at all on anyone just wondering cos basically that stack_ban proc is reinventing the wheel, but that's me. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 831 Location: Tennessee, USA
|
Posted: Fri Mar 27, 2015 1:52 am Post subject: |
|
|
I have seen this one run, and to me this version does no better at "stacks bans". I believe that part of the script is still far from resolved.
But it does now monitor the channel for ACTION and notice floods to the channel. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3775 Location: Mint Factory
|
Posted: Fri Mar 27, 2015 5:26 am Post subject: |
|
|
If he's going to continue to ignore my questions or advices then fine by me, I'll just mind my day.
Ran a few tests and having multiple +b's while banning one mask caused some errors on my Undernet tests. Still, that there's no need for multiple
Code: |
if {[llength $banlist]
|
when can just use switch.
Edit: Since I love a good challenge I decided to do my own version of that stack_ban proc and came up with:
Code: |
while {[llength $banList] != 0} {
set len [llength $banList]
if {$len > 6} {
set mode "bbbbbb"
set masks [lrange $banList 0 5]
set banList [lrange $banList 6 end]
} else {
set mode [string repeat "b" $len]
set masks [lrange $banList 0 $len]
set banList ""
}
# do whatever with $mode and $masks
}
|
Basically it adds the exact amount of b's depending on the amount of masks to ban that are in the list.
Did some testing with:
Code: |
set chan "#test"
set banList "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
|
and works as expected:
Quote: |
MODE #test +bbbbbb 1 2 3 4 5 6
MODE #test +bbbbbb 7 8 9 10 11 12
MODE #test +bbb 13 14 15
|
And here's the code added in the rp_dobans proc.
Code: |
proc rp_dobans {chan uhlist} {
global rp_breason
if {![botisop $chan]} return
set max "6"
set banList ""
set nickList ""
foreach ele $uhlist {
scan $ele {%[^!]!%[^@]@%s} nick user host
set bmask "*!*@$host"
if {[lsearch $banList $bmask] != -1} continue
lappend banList $bmask
lappend nickList $nick
}
while {[llength $banList] != 0} {
set len [llength $banList]
if {$len > $max} {
set mode "bbbbbb"
set masks [lrange $banList 0 [expr $max - 1]]
set banList [lrange $banList $max end]
} else {
set mode [string repeat "b" $len]
set masks [lrange $banList 0 $len]
set banList ""
}
putquick "MODE $chan +$mode $masks" -next
}
flushmode $chan
while {[llength $nickList] != 0} {
putquick "KICK $chan [lindex $nickList 0] :$rp_breason" -next
set nickList [lrange $nickList 1 end]
}
}
|
Please notice the max variable that you can change to whatever modes your server allows. That's the only required change for it to do as many modes per line the server allows.
And here's some tests on a bot:
Quote: |
[14:01] <@cez> !hash *!*@1 *!*@2 *!*@3 *!*@4 *!*@5 *!*@6 *!*@7 *!*@8 *!*@9 *!*@10 *!*@11 *!*@12 *!*@13 *!*@14 *!*@15 *!*@16 *!*@17
[14:01] * Bot sets mode: +bbbbbb *!*@1 *!*@2 *!*@3 *!*@4 *!*@5 *!*@6
[14:01] * Bot sets mode: +bbbbbb *!*@7 *!*@8 *!*@9 *!*@10 *!*@11 *!*@12
[14:01] * Bot sets mode: +bbbbb *!*@13 *!*@14 *!*@15 *!*@16 *!*@17
[14:02] <@cez> !hash *!*@1 *!*@2 *!*@3 *!*@4 *!*@5 *!*@6 *!*@7 *!*@8 *!*@9 *!*@10 *!*@11 *!*@12 *!*@13 *!*@14
[14:02] * Bot sets mode: +bbbbbb *!*@1 *!*@2 *!*@3 *!*@4 *!*@5 *!*@6
[14:02] * Bot sets mode: +bbbbbb *!*@7 *!*@8 *!*@9 *!*@10 *!*@11 *!*@12
[14:03] * Bot sets mode: +bb *!*@13 *!*@14
[14:03] <@cez> !hash *!*@1 *!*@2 *!*@3
[14:03] * Bot sets mode: +bbb *!*@1 *!*@2 *!*@3
[14:04] <@cez> !hash *!*@1 *!*@2 *!*@3 *!*@4 *!*@5 *!*@6 *!*@7
[14:04] * Bot sets mode: +bbbbbb *!*@1 *!*@2 *!*@3 *!*@4 *!*@5 *!*@6
[14:04] * Bot sets mode: +b *!*@7
|
And here's an additional test with max 4 masks per line, even if server allows 6 (or could be more)
Quote: |
[14:13] <@cez> !hash *!*@1 *!*@2 *!*@3 *!*@4 *!*@5 *!*@6 *!*@7 *!*@8 *!*@9 *!*@10 *!*@11 *!*@12 *!*@13 *!*@14 *!*@15 *!*@16 *!*@17
[14:13] * Bot sets mode: +bbbb *!*@1 *!*@2 *!*@3 *!*@4
[14:13] * Bot sets mode: +bbbb *!*@5 *!*@6 *!*@7 *!*@8
[14:13] * Bot sets mode: +bbbb *!*@9 *!*@10 *!*@11 *!*@12
[14:13] * Bot sets mode: +bbbb *!*@13 *!*@14 *!*@15 *!*@16
[14:13] * Bot sets mode: +b *!*@17
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Fri Mar 27, 2015 8:20 am Post subject: |
|
|
how about a seperate tcl to stack bans in general wich uses the max amount of modes that can be set in 1 line of server in mirc there is an identifier for it $modespl it retreives max amount of modes that can be set in 1 line
This is what mirc uses to stack modes. |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Fri Mar 27, 2015 9:00 am Post subject: |
|
|
since we are at it how about a new kind of flood monitor wich monitors lines and amount of characters but instead of per user ( like all text flood monitor scripts ) do channel wide like this one and start kick banning instead of the usual channel lock wich most of them use |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3775 Location: Mint Factory
|
Posted: Fri Mar 27, 2015 9:34 am Post subject: |
|
|
On Undernet network I get the max modes per line under RAW 005
Quote: |
[14:36] WHOX WALLCHOPS WALLVOICES USERIP CPRIVMSG CNOTICE SILENCE=25 MODES=6 MAXCHANNELS=20 MAXBANS=50 NICKLEN=12 are supported by this server
[14:36] MAXNICKLEN=15 TOPICLEN=160 AWAYLEN=160 KICKLEN=160 CHANNELLEN=200 MAXCHANNELLEN=200 CHANTYPES=#& PREFIX=(ov)@+ STATUSMSG=@+ CHANMODES=b,k,l,imnpstrDdR CASEMAPPING=rfc1459 NETWORK=UnderNet are supported by this server
|
How's on your server? _________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Fri Mar 27, 2015 10:05 am Post subject: |
|
|
KICKLEN=255 MAP MAXBANS=60 MAXCHANNELS=10 MAXPARA=32 MAXTARGETS=20 MODES=20 NAMESX NETWORK=ServerNet NICKLEN=31 OVERRIDE PREFIX=(YqaohvV)!~&@%+- REMOVE are supported by this server |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3775 Location: Mint Factory
|
Posted: Fri Mar 27, 2015 10:58 am Post subject: |
|
|
Code: |
proc stack_ban {chan banlist} {
if {![botisop $chan]} return
set max 6
set len [llength $banlist]
while {$len != 0} {
if {$len > $max} {
set mode [string repeat "b" $max]
set masks [lrange $banlist 0 [expr $max - 1]]
set banlist [lrange $banlist $max end]
incr len -$max
} else {
set mode [string repeat "b" $len]
set masks [lrange $banlist 0 $len]
set banlist ""
set len 0
}
putquick "MODE $chan +$mode $masks" -next
}
return $banlist
}
|
Honestly unless you plan to hop servers with different setting for max modes per line, I don't see any point into grabbing that info in the first place when you can have that max setting hard-coded in the script itself without any problem whatsoever. And if that setting happens to change, then you can just change it in the script too.
If you want to have different settings for how many ban modes to push in a single line for each channel separated then that's a different thing and can be easily achieved with setudef str. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 831 Location: Tennessee, USA
|
Posted: Mon Mar 30, 2015 5:13 pm Post subject: |
|
|
Script tries to put multiple nicks in the same ban command to the server.
This is the super-fast-egg-on-steroids version of this script!!!
DO NOT run this script unless your bot is opered and has no limits!
Code: |
# multi-host-repeat.tcl v1.3 by SpiKe^^, closely based on
# repeat.tcl v1.1 (9 April 1999) by slennox <slenny@ozemail.com.au>
# Special Thanks go out to speechles & caesar
## IMPORTANT ## DANGER ## IMPORTANT ## DANGER ## IMPORTANT ## DANGER ##
## This is the super-fast-egg-on-steroids version of this script!!!
## DO NOT run this script unless your bot is opered and has no limits!
## IMPORTANT ## DANGER ## IMPORTANT ## DANGER ## IMPORTANT ## DANGER ##
# Repeat flood, kick-ban on repeats:seconds #
set mhrp(flood) 3:10
# Repeat flood kick-ban reason #
set mhrp(reasn) "repeat flood"
# Max number of bans to stack in one mode command #
set mhrp(maxb) 6
# Length of time in minutes to ban Repeat flooders #
# NOT USED at this time #set mhrp(btime) 1
# After a valid Repeat flood, script will continue to #
# kick-ban offenders for an additional 'x' seconds #
set mhrp(xpire) 10
# END OF SETTINGS # Don't edit below unless you know what you're doing #
bind pubm - * rp_pubmsg
bind notc - * notc_wrap
bind ctcp - "ACTION" action_wrap
proc action_wrap {n u h d k t} { rp_pubmsg $n $u $h $d $t }
proc notc_wrap {n u h t d} { rp_pubmsg $n $u $h $d $t }
proc rp_pubmsg {nick uhost hand chan text} {
global mhrp mhrc mhrq
set uhost [string tolower $nick!$uhost]
set chan [string tolower $chan]
set text [string map [list \017 ""] [stripcodes abcgru $text]]
set text [string tolower $text]
if {[isbotnick $nick]} { return 0 }
if {[matchattr $hand f|f $chan]} { return 0 }
set utnow [unixtime]
set target [lindex $mhrp(flood) 0]
if {[info exists mhrc($chan:$text)]} {
set uhlist [lassign $mhrc($chan:$text) cnt ut]
set utend [expr {$ut + [lindex $mhrp(flood) 1]}]
set expire [expr {$utend + $mhrp(xpire)}]
if {$cnt < $target} {
if {$utnow > $utend} { unset mhrc($chan:$text) }
} elseif {$utnow > $expire} { unset mhrc($chan:$text) }
}
if {![info exists mhrc($chan:$text)]} {
set mhrc($chan:$text) [list 1 $utnow $uhost]
return 0
}
incr cnt
if {$cnt <= $target} {
if {[lsearch $uhlist $uhost] == -1} { lappend uhlist $uhost }
if {$cnt < $target} {
set mhrc($chan:$text) [linsert $uhlist 0 $cnt $ut]
} else {
set mhrc($chan:$text) [list $cnt $ut]
rp_dobans $chan $uhlist
}
return 0
}
if {![info exists mhrq($chan)]} {
utimer 1 [list rp_bque $chan]
set mhrq($chan) [list $uhost]
} elseif {[lsearch $mhrq($chan) $uhost] == -1} {
lappend mhrq($chan) $uhost
}
if {[llength $mhrq($chan)] >= $mhrp(maxb)} {
rp_dobans $chan $mhrq($chan)
set mhrq($chan) ""
} elseif {[botisop $chan]} { putnow "KICK $chan $nick :$mhrp(reasn)" }
return 0
}
proc rp_dobans {chan uhlist} {
global mhrp
if {![botisop $chan]} return
set banList ""
set nickList ""
foreach ele $uhlist {
scan $ele {%[^!]!%[^@]@%s} nick user host
set bmask "*!*@$host"
if {[lsearch $banList $bmask] == -1} { lappend banList $bmask }
if {[lsearch $nickList $nick] == -1} { lappend nickList $nick }
}
stack_ban $chan $mhrp(maxb) $banList
foreach nk $nickList {
if {[onchan $nk $chan]} { putnow "KICK $chan $nk :$mhrp(reasn)" }
}
}
proc stack_ban {chan max banlist} {
set len [llength $banlist]
while {$len > 0} {
if {$len > $max} {
set mode [string repeat "b" $max]
set masks [join [lrange $banlist 0 [expr $max - 1]]]
set banlist [lrange $banlist $max end]
incr len -$max
} else {
set mode [string repeat "b" $len]
set masks [join $banlist]
set len 0
}
putnow "MODE $chan +$mode $masks"
}
}
proc rp_bque {chan} {
global mhrq
if {![info exists mhrq($chan)]} { return }
if {$mhrq($chan) eq ""} { unset mhrq($chan) ; return }
rp_dobans $chan $mhrq($chan)
unset mhrq($chan)
}
proc rp_breset {} {
global mhrc mhrp
set utnow [unixtime]
set target [lindex $mhrp(flood) 0]
foreach {key val} [array get mhrc] {
lassign $val cnt ut
set utend [expr {$ut + [lindex $mhrp(flood) 1]}]
set expire [expr {$utend + $mhrp(xpire)}]
if {$cnt < $target} {
if {$utnow > $utend} { unset mhrc($key) }
} elseif {$utnow > $expire} { unset mhrc($key) }
}
utimer 30 [list rp_breset]
}
if {![info exists rp_running]} {
utimer 30 [list rp_breset]
set rp_running 1
}
set mhrp(flood) [split $mhrp(flood) :]
putlog "Loaded multi-host-repeat.tcl v1.3 by SpiKe^^"
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Last edited by SpiKe^^ on Mon Mar 30, 2015 11:43 pm; edited 2 times in total |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Mon Mar 30, 2015 6:11 pm Post subject: |
|
|
works well SpiKe^^ nice job |
|
Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 831 Location: Tennessee, USA
|
Posted: Tue Mar 31, 2015 2:50 pm Post subject: |
|
|
Final copy of: the super-fast-egg-on-steroids version of this script!!!
DO NOT run this script unless your bot is opered and has no limits!
This version has the option of setting user specified channel modes when a flood is detected.
Code: |
# multi-host-repeat.tcl v1.3 (31Mar2015) by SpiKe^^, closely based on
# repeat.tcl v1.1 (9 April 1999) by slennox <slenny@ozemail.com.au>
# Special Thanks go out to speechles & caesar
## IMPORTANT ## DANGER ## IMPORTANT ## DANGER ## IMPORTANT ## DANGER ##
## This is the super-fast-egg-on-steroids version of this script!!!
## DO NOT run this script unless your bot is opered and has no limits!
## IMPORTANT ## DANGER ## IMPORTANT ## DANGER ## IMPORTANT ## DANGER ##
# Repeat flood, kick-ban on repeats:seconds #
set mhrp(flood) 3:10
# Repeat flood kick-ban reason #
set mhrp(reasn) "repeat flood"
# Max number of bans to stack in one mode command #
set mhrp(maxb) 6
# Length of time in minutes to ban Repeat flooders #
# NOT USED at this time #set mhrp(btime) 1
# After a valid Repeat flood, script will continue to #
# kick-ban offenders for an additional 'x' seconds #
set mhrp(xpire) 10
# Set channel mode(s) on flood detected. #
# - set empty to disable setting channel modes (ex. set mhrp(mode) "") #
set mhrp(mode) "mi"
# Remove these channel modes after how many seconds? #
set mhrp(mrem) 20
# END OF SETTINGS # Don't edit below unless you know what you're doing #
bind pubm - * rp_pubmsg
bind notc - * notc_wrap
bind ctcp - "ACTION" action_wrap
proc action_wrap {n u h d k t} { rp_pubmsg $n $u $h $d $t }
proc notc_wrap {n u h t d} { rp_pubmsg $n $u $h $d $t }
proc rp_pubmsg {nick uhost hand chan text} {
global mhrp mhrc mhrq
set uhost [string tolower $nick!$uhost]
set chan [string tolower $chan]
set text [string map [list \017 ""] [stripcodes abcgru $text]]
set text [string tolower $text]
if {[isbotnick $nick]} { return 0 }
if {[matchattr $hand f|f $chan]} { return 0 }
set utnow [unixtime]
set target [lindex $mhrp(flood) 0]
if {[info exists mhrc($chan:$text)]} {
set uhlist [lassign $mhrc($chan:$text) cnt ut]
set utend [expr {$ut + [lindex $mhrp(flood) 1]}]
set expire [expr {$utend + $mhrp(xpire)}]
if {$cnt < $target} {
if {$utnow > $utend} { unset mhrc($chan:$text) }
} elseif {$utnow > $expire} { unset mhrc($chan:$text) }
}
if {![info exists mhrc($chan:$text)]} {
set mhrc($chan:$text) [list 1 $utnow $uhost]
return 0
}
incr cnt
if {$cnt <= $target} {
if {[lsearch $uhlist $uhost] == -1} { lappend uhlist $uhost }
if {$cnt < $target} {
set mhrc($chan:$text) [linsert $uhlist 0 $cnt $ut]
} else {
set mhrc($chan:$text) [list $cnt $ut]
if {$mhrp(mode) ne "" && [string is digit -strict $mhrp(mrem)]} {
putnow "MODE $chan +$mhrp(mode)"
utimer $mhrp(mrem) [list putnow "MODE $chan -$mhrp(mode)"]
}
rp_dobans $chan $uhlist
}
return 0
}
if {![info exists mhrq($chan)]} {
utimer 1 [list rp_bque $chan]
set mhrq($chan) [list $uhost]
} elseif {[lsearch $mhrq($chan) $uhost] == -1} {
lappend mhrq($chan) $uhost
}
if {[llength $mhrq($chan)] >= $mhrp(maxb)} {
rp_dobans $chan $mhrq($chan)
set mhrq($chan) ""
} elseif {[botisop $chan]} { putnow "KICK $chan $nick :$mhrp(reasn)" }
return 0
}
proc rp_dobans {chan uhlist} {
global mhrp
if {![botisop $chan]} return
set banList ""
set nickList ""
foreach ele $uhlist {
scan $ele {%[^!]!%[^@]@%s} nick user host
set bmask "*!*@$host"
if {[lsearch $banList $bmask] == -1} { lappend banList $bmask }
if {[lsearch $nickList $nick] == -1} { lappend nickList $nick }
}
stack_ban $chan $mhrp(maxb) $banList
foreach nk $nickList {
if {[onchan $nk $chan]} { putnow "KICK $chan $nk :$mhrp(reasn)" }
}
}
proc stack_ban {chan max banlist} {
set len [llength $banlist]
while {$len > 0} {
if {$len > $max} {
set mode [string repeat "b" $max]
set masks [join [lrange $banlist 0 [expr {$max - 1}]]]
set banlist [lrange $banlist $max end]
incr len -$max
} else {
set mode [string repeat "b" $len]
set masks [join $banlist]
set len 0
}
putnow "MODE $chan +$mode $masks"
}
}
proc rp_bque {chan} {
global mhrq
if {![info exists mhrq($chan)]} { return }
if {$mhrq($chan) eq ""} { unset mhrq($chan) ; return }
rp_dobans $chan $mhrq($chan)
unset mhrq($chan)
}
proc rp_breset {} {
global mhrc mhrp
set utnow [unixtime]
set target [lindex $mhrp(flood) 0]
foreach {key val} [array get mhrc] {
lassign $val cnt ut
set utend [expr {$ut + [lindex $mhrp(flood) 1]}]
set expire [expr {$utend + $mhrp(xpire)}]
if {$cnt < $target} {
if {$utnow > $utend} { unset mhrc($key) }
} elseif {$utnow > $expire} { unset mhrc($key) }
}
utimer 30 [list rp_breset]
}
if {![info exists rp_running]} {
utimer 30 [list rp_breset]
set rp_running 1
}
set mhrp(flood) [split $mhrp(flood) :]
putlog "Loaded multi-host-repeat.tcl v1.3 by SpiKe^^"
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Tue Mar 31, 2015 3:05 pm Post subject: |
|
|
excellent end result spike^^
this one adds timed channel lock when repeated text is detected to prevent any further abuse
thanx again |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Sat Apr 18, 2015 7:49 am Post subject: |
|
|
could the bans be set to be removed after like 10 minutes |
|
Back to top |
|
 |
|