egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

anti repeat from multi host/ip
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3740
Location: Mint Factory

PostPosted: Wed Mar 25, 2015 11:23 am    Post subject: Reply with quote

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:

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:

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

with:
Code:

   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.
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 859

PostPosted: Wed Mar 25, 2015 12:26 pm    Post subject: Reply with quote

i replaced the part you posted caesar it doesn seem to compress ban modes
in 1 line as much as possible

Quote:
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 )
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3740
Location: Mint Factory

PostPosted: Wed Mar 25, 2015 12:38 pm    Post subject: Reply with quote

Then do:
Code:

/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:
Quote:

17:23:48 (1 User) is Banned (1) Seidel

Your IRC Client adding stuff?

Also, I see this guys saying the same stuff:
Quote:

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? Smile
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 770
Location: Tennessee, USA

PostPosted: Wed Mar 25, 2015 1:34 pm    Post subject: Reply with quote

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
.
Back to top
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 859

PostPosted: Wed Mar 25, 2015 1:34 pm    Post subject: Reply with quote

i already said max modes per line is 15 in inspircd
and i tried using +bbbbbbbbbbbbbbb but it still sets per user user
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 859

PostPosted: Wed Mar 25, 2015 1:57 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 770
Location: Tennessee, USA

PostPosted: Wed Mar 25, 2015 2:04 pm    Post subject: Reply with quote

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
.
Back to top
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 859

PostPosted: Wed Mar 25, 2015 2:08 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 859

PostPosted: Wed Mar 25, 2015 2:15 pm    Post subject: Reply with quote

this is what i have so far

Code:
# 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^^"
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 859

PostPosted: Wed Mar 25, 2015 2:19 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 770
Location: Tennessee, USA

PostPosted: Wed Mar 25, 2015 2:19 pm    Post subject: Reply with quote

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
.
Back to top
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 859

PostPosted: Wed Mar 25, 2015 2:24 pm    Post subject: Reply with quote

with my own client it looks like this and this is the aim i had

Quote:
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 *** )
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 859

PostPosted: Wed Mar 25, 2015 2:25 pm    Post subject: Reply with quote

as i mentioned i dont want any queu i want all to be send immediate and compressed mode settings as seen in post above
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 770
Location: Tennessee, USA

PostPosted: Wed Mar 25, 2015 2:30 pm    Post subject: Reply with quote

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
.
Back to top
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 859

PostPosted: Wed Mar 25, 2015 2:47 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Page 4 of 8

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber