This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

anti repeat from multi host/ip

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

SpiKe^^ wrote:It may be worth mentioning, the uhosts in uhlist are like this: nick!user@host
Ahh, I just noticed that. At first glance saw uhost and expected user@host but now saw that you replaced it with nick!user@host.

Give this a try:

Code: Select all

proc rp_dobans {chan uhlist} {
	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} {
      puthelp "MODE $chan +b [join [lrange $banList 0 6] " "]"
      set banList [lrange $banList 6 end]
   }
   while {[llength $nickList] != 0} {
      putkick $chan [join [lrange $nickList 0 6] ","] "repeat flood"
      set nickList [lrange $nickList 6 end]
   }
}
For now haven't changed the queue nor the amount of modes/kicks per line. Feel free to adjust the limits based on the server settings and swith from puthelp queue to putquick and replace:

Code: Select all

   while {[llength $nickList] != 0} {
      putkick $chan [join [lrange $nickList 0 6] ","] "repeat flood"
      set nickList [lrange $nickList 6 end]
   }
with:

Code: Select all

	foreach n [split $nickList] {
		putquick "KICK $chan $n :repeat flood"
	}
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i replaced the part you posted caesar it doesn seem to compress ban modes
in 1 line as much as possible
17:23:48 (Mathews) : waxlkx khjskjsfkjsfkjsfkjkj tpjdsl
17:23:48 (Mauro) : waxlkx khjskjsfkjsfkjsfkjkj tpjdsl
17:23:48 (Paul) : waxlkx khjskjsfkjsfkjsfkjkj tpjdsl
17:23:48 (Debora) : waxlkx khjskjsfkjsfkjsfkjkj tpjdsl
17:23:48 Faison Kicked from #servernet By @security ( repeat flood )
17:23:48 @SeCuRiTy Sets Mode on #servernet to: +b *!*@servernet-bva5s7.res.rr.com
17:23:48 (1 User) is Banned (1) Seidel
17:23:48 (Coombs) : waxlkx khjskjsfkjsfkjsfkjkj tpjdsl
17:23:48 Seidel Kicked from #servernet By @security ( repeat flood )
17:23:48 (Guess) : waxlkx khjskjsfkjsfkjsfkjkj tpjdsl
17:23:48 @SeCuRiTy Sets Mode on #servernet to: +b *!*@servernet-5utjt9.teamcity.cz
17:23:48 (1 User) is Banned (1) Kunz
17:23:48 (Stinson) : waxlkx khjskjsfkjsfkjsfkjkj tpjdsl
17:23:48 Kunz Kicked from #servernet By @security ( repeat flood )
17:23:48 @SeCuRiTy Sets Mode on #servernet to: +b *!*@servernet-7le.9c3.152.107.ip
17:23:48 (1 User) is Banned (1) Kilpatrick
17:23:48 (Cornelius) : waxlkx khjskjsfkjsfkjsfkjkj tpjdsl
17:23:48 Kilpatrick Kicked from #servernet By @security ( repeat flood )
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Then do:

Code: Select all

/mode #channel +b *!*@one *!*@two *!*@three *!*@four *!*@five *!*@six 
from your IRC Client and if that doesn't add all 6 bans in one line then try with +b+b+b+b+b+b instead of one +b.

What's with the:
17:23:48 (1 User) is Banned (1) Seidel
Your IRC Client adding stuff?

Also, I see this guys saying the same stuff:
17:23:48 (Mathews) : waxlkx khjskjsfkjsfkjsfkjkj tpjdsl
17:23:48 (Mauro) : waxlkx khjskjsfkjsfkjsfkjkj tpjdsl
17:23:48 (Paul) : waxlkx khjskjsfkjsfkjsfkjkj tpjdsl
17:23:48 (Debora) : waxlkx khjskjsfkjsfkjsfkjkj tpjdsl
yet I see different people getting kicked/banned. What's up with that? doing multiple tests at the same time and doing a mixed copy/paste of the results? :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

On undernet anyway, the correct mode line is more like: /mode #pc-mirc-help +bbb *!*@one *!*@two *!*@three
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i already said max modes per line is 15 in inspircd
and i tried using +bbbbbbbbbbbbbbb but it still sets per user user
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

the kicks are instant and fine all that remains is to compress the modes
as much as possible so channel doesnt get flooded with mode settings

other than that its a fine code executing perfecly
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Let's understand how the script is working...

1) On the first instance of a text string, the script records the string with the time it was said and who said it.
2) Assuming you are still using the settings you posted earlier, on the 2nd case of the same string in the set time, the script sees a repeat flood and tries to ban and kick both offenders.
3) With each new repeated string, within the monitored time, the script attempts to remove the offender immediately, as you requested.

There is no way to queue them up AND respond immediately, all at the same time:)

So at best, you are looking at banning the first 2 persons (triggered the flood) in the same mode line, then each additional offender, as they chime in.

Best I can tell, KICKS are always done one nick at a time.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

thank you spike^^ for the explanation of the working of the code the kicks is all fine as you mentioned kicks are always per user as there is no multi kick in 1 line possible the only thing wich is missing is the compression of modes beeing set
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

this is what i have so far

Code: Select all

# multi-host-repeat.tcl v1.0 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

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} {
   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} {
      pushmode $chan "+bbbbbbbbbbbbbbb"  " [join [lrange $banList 0 15] " "]"
      #puthelp "MODE $chan +bbbbbbbbbbbbbbb [join [lrange $banList 0 15] " "]"
      set banList [lrange $banList 15 end]
   }
   foreach n [split $nickList] {
      putquick "KICK $chan $n :repeat flood"
   }
} 

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^^" 
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

oh i just did test with action it seems code only works for text and not for when flood is done using action or /me
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

The way I see it, you have 2 conflicting requests:

1) send the modes commands immediately
2) wait long enough to Queue more than 1 mode in the same command

Or am I missing something here?
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

with my own client it looks like this and this is the aim i had
19:23:41 Rasmussen Kicked from #servernet By @simo ( *** Don't Repeat Please *** )
19:23:41 Sean Kicked from #servernet By @simo ( *** Don't Repeat Please *** )
19:23:41 Estes Kicked from #servernet By @simo ( *** Don't Repeat Please *** )
19:23:41 Smart Kicked from #servernet By @simo ( *** Don't Repeat Please *** )
19:23:41 Marquitta Kicked from #servernet By @simo ( *** Don't Repeat Please *** )
19:23:41 Olivarez Kicked from #servernet By @simo ( *** Don't Repeat Please *** )
19:23:41 Burger Kicked from #servernet By @simo ( *** Don't Repeat Please *** )
19:23:41 (Earls) : kqrophxyjjrdgguyipet mnmnckjder984nsf uynezdhkrcbsvittakip
19:23:41 Stump Kicked from #servernet By @simo ( *** Don't Repeat Please *** )
19:23:41 Mcclain Kicked from #servernet By @simo ( *** Don't Repeat Please *** )
19:23:41 Arianne Kicked from #servernet By @simo ( *** Don't Repeat Please *** )
19:23:41 Guess Kicked from #servernet By @simo ( *** Don't Repeat Please *** )
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
19:23:41 Ferraro Kicked from #servernet By @simo ( *** Don't Repeat Please *** )
19:23:41 Harbin Kicked from #servernet By @simo ( *** Don't Repeat Please *** )
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

as i mentioned i dont want any queu i want all to be send immediate and compressed mode settings as seen in post above
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Bummerz, compressing modes implies a queue to wait for enough modes to send. I may be done with this string.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

is there an option to exempt channel ops halfops admins owner(founder) from beeing effected by this code

with compressed mode i mean as much modes in 1 line as possible in this case per 15
SpiKe^^ wrote:Bummerz, compressing modes implies a queue to wait for enough modes to send. I may be done with this string.
indeed thats what i meant sir

also does this only work for msg only and not for messages sent with /me
Post Reply