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.

Detecting identical nicks within time frame

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

tested your last posted code Spike^^ it seems to work it sets the bans but doesnt kick and with each test i have to restart it to test again else it doest trigger
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

tested again with 10 clones it took like 10 seconds to get them
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

fixed variable name

Post by SpiKe^^ »

FIXED a variable naming issue from some reused code in proc dobans:clonednicks in the script post above.

Code: Select all

    ##putserv "KICK $ch $nicks :!!! Indentical nicks !!!"
    putserv "KICK $chan $nicks :!!! Indentical nicks !!!"
Download the edited ver 0.1 script and try your tests again.
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: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Re: fixed variable name

Post by simo »

SpiKe^^ wrote:FIXED a variable naming issue from some reused code in proc dobans:clonednicks in the script post above.

Code: Select all

    ##putserv "KICK $ch $nicks :!!! Indentical nicks !!!"
    putserv "KICK $chan $nicks :!!! Indentical nicks !!!"
Download the edited ver 0.1 script and try your tests again.
Oh infact i already corrected that and tested with if opered it set the bans and kicks instantly but un-opered it freezes and takes 10sec to react and i limited to 10 identical nicks wich isn't much
Last edited by simo on Thu Nov 25, 2021 1:56 am, edited 1 time in total.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Thanks for not bothering to tell me about the variable name issue.

What's the difference between if opered and not?
Are you changing the putquck to putnow?
Explain what you are doing to make it speed up and slow down.
That wouldn't be anything the script could change there?
Try speeding up the queue after or maybe even slowing it some (it is one second now = 1000ms)
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: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

SpiKe^^ wrote:Thanks for not bothering to tell me about the variable name issue.

What's the difference between if opered and not?
Are you changing the putquck to putnow?
Explain what you are doing to make it speed up and slow down.
That wouldn't be anything the script could change there?
Try speeding up the queue after or maybe even slowing it some (it is one second now = 1000ms)
Oh yea sorry was doing some testing was gonna tell ya about the var
No i kept it as is except i opered it altho it shouldn't make a difference just like your anti mass join tcl is decently fast opered and non opered
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

OK, sounds like that code is fine.
Thanks
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: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

if its opered it works as expected but for using as non opered it would take 10 seconds and longer for it to react tho and it somewhat freezes and is non responsive

15:13:15 Join: clonedyuuppqaqv [ident: Mibbit] *!*@Cloacked-so0.bww.957.408.IP
15:13:15 Join: clonedzt [ident: Mibbit] *!*@Cloacked-yt3.urd.878.658.IP
15:13:15 Join: clonedgx [ident: Mibbit] *!*@Cloacked-721.395.971.995.IP
15:13:15 Join: clonedop [ident: Mibbit] *!*@Cloacked-7au.fcq.288.663.IP
15:13:15 Join: clonedyy [ident: Mibbit] *!*@Cloacked-j4e.jve.633.765.IP
15:13:15 Join: clonedjxltq [ident: Mibbit] *!*@Cloacked-2ep.625.174.499.IP
15:13:15 Join: clonedminfhm [ident: Mibbit] *!*@Cloacked-959.t5y.346.423.IP
15:13:15 Join: clonedeuqlei [ident: Mibbit] *!*@Cloacked-rm0.kyf.428.744.IP
15:13:15 Join: clonedrqyoiliw [ident: Mibbit] *!*@Cloacked-5zp.n83.075.093.IP

15:13:33 @Hawk Sets Mode on #test to: +bbbbbbbbb *!*@Cloacked-so0.bww.957.408.IP *!*@Cloacked-yt3.urd.878.658.IP *!*@Cloacked-721.395.971.995.IP *!*@Cloacked-7au.fcq.288.663.IP *!*@Cloacked-j4e.jve.633.765.IP *!*@Cloacked-2ep.625.174.499.IP *!*@Cloacked-959.t5y.346.423.IP *!*@Cloacked-rm0.kyf.428.744.IP *!*@Cloacked-5zp.n83.075.093.IP

15:13:33 clonedyuuppqaqv Kicked from #test By @Hawk ( !!! Indentical nicks !!! )
15:13:33 clonedzt Kicked from #test By @Hawk ( !!! Indentical nicks !!! )
15:13:34 clonedgx Kicked from #test By @Hawk ( !!! Indentical nicks !!! )
15:13:34 clonedop Kicked from #test By @Hawk ( !!! Indentical nicks !!! )
15:13:34 clonedyy Kicked from #test By @Hawk ( !!! Indentical nicks !!! )
15:13:34 clonedjxltq Kicked from #test By @Hawk ( !!! Indentical nicks !!! )
15:13:34 clonedminfhm Kicked from #test By @Hawk ( !!! Indentical nicks !!! )
15:13:34 clonedeuqlei Kicked from #test By @Hawk ( !!! Indentical nicks !!! )
15:13:34 clonedrqyoiliw Kicked from #test By @Hawk ( !!! Indentical nicks !!! )
Last edited by simo on Thu Nov 25, 2021 10:21 am, edited 1 time in total.
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

anyway to have it react instant non opered as well ?
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

According to the above quote the whole deal was done in under 2/10ths of a second...

Show the channel logs when it doesn't.
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: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

tested again with only the identical tcl loaded as u suggested on IRC and it worked excactly as expected and reacts instant and gets all identical nicks
very nice indeed thanks SpiKe^^ much apreciated
Last edited by simo on Thu Nov 25, 2021 11:41 am, edited 1 time in total.
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i also took this opportunity to cleanup my config as i had files all over the place files i hardly used and that cleaned the issues i had

thanks SpiKe^^ much apreciated
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i tried adding the part that sets ban on the identical part SpiKe^^ not sure why it failed it sets the +R tho

http://paste.tclhelp.net/?id=6qr1

added it on line 34

oh i forgot i already took it out from this paste

the putquick "MODE $chan +R"

it was

putquick "MODE $chan +Rb $::key*!*@* "
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Code: Select all


#### clonednicks.tcl ver 0.1 by SpiKe^^ (24Nov2021) ####



bind join - * join:clonednicks

proc join:clonednicks {nick uhost hand chan} {
	global cnicks cnickq

	if {[isbotnick $nick] || ([string length $nick] < 6)} { return 0 }
	if {[matchattr $hand f|f $chan]} { return 0 }

	set chan [string tolower $chan]
	set key [string tolower [string range $nick 0 4]]
	set now [clock milliseconds]

	if {[info exists cnicks(${key},$chan)]} {
		## just expire any old entries ##
		set old [expr {$now - (3 * 1000)}]
		set newls [list]
		foreach joined $cnicks(${key},$chan) {
			if {[lindex [split $joined ","] 1] > $old} { lappend newls $joined }
		}
		if {![llength $newls]} {  unset cnicks(${key},$chan)
		} else {  set cnicks(${key},$chan) $newls  }
	}
	if {![info exists cnicks(${key},$chan)]} {
		set cnicks(${key},$chan) [list "0,${now},${nick}!$uhost"]
		return 0
	}

	if {![info exists cnickq($chan)]} {
		lock:chanz $chan
		after 500 [list dobans:clonednicks $chan]
	}
	if {[string match "0,*" [set first [lindex $cnicks(${key},$chan) 0]]]} {
		set cnicks(${key},$chan) [list "1,[string range $first 2 end]"]
		lappend cnickq($chan) [lindex [split $first ","] 2]
	}

	lappend cnicks(${key},$chan) "1,${now},${nick}!$uhost"
	lappend cnickq($chan) "${nick}!$uhost"
	return 0
}


proc dobans:clonednicks {chan} {
	global cnickq

	if {![info exists cnickq($chan)]} { return 0 }
	if {![llength $cnickq($chan)] || ![botisop $chan]} {
		unset cnickq($chan)  ;  return 0
	}

	set bmasks [list]  ;  set knicks [list]
	foreach nkuhost $cnickq($chan) {
		lassign [split $nkuhost "!@"] n u h
		lappend knicks $n
		lappend bmasks *!*@$h
	}

	set max 12
	while {[set len [llength $bmasks]] > 0} {
		if {$len > $max} {
			set mode [string repeat "b" $max]
			set masks [join [lrange $bmasks 0 [expr {$max - 1}]]]
			set bmasks [lrange $bmasks $max end]
		} else {
			set mode [string repeat "b" $len]
			set masks [join $bmasks]
			set bmasks ""
		}
		putserv "mode $chan +$mode $masks"
	}

	set max 20
	while {[set len [llength $knicks]] > 0} {
		if {$len > $max} {
			set nicks [join [lrange $knicks 0 [expr {$max - 1}]] ","]
			set knicks [lrange $knicks $max end]
		} else {
			set nicks [join $knicks ","]
			set knicks ""
		}
		putquick "kick $chan $nicks :!!! Indentical nicks !!!"
	}

	unset cnickq($chan)  ;  return 0
}


bind cron - {* * * * *} cleanup:clonednicks

proc cleanup:clonednicks {mn hr da mo wd} {
	global cnicks
	set old [expr {[clock milliseconds] - (3 * 1000)}]

	foreach {key val} [array get cnicks] {
		set newls [list]
		foreach joined $val {
			if {[lindex [split $joined ","] 1] > $old} { lappend newls $joined }
		}
		if {![llength $newls]} {  unset cnicks($key)
		} else {  set cnicks($key) $newls  }
	}
}



proc lock:chanz {chan} {
	global botnick chan_flooded

	if {![info exists chan_flooded($chan)]} {
		set chan_flooded($chan) 1
		putquick "MODE $chan +Rb $::key*!*@*"
		utimer 5 [list putquick MODE $chan -R]
		utimer 5 [list unset -nocomplain chan_flooded($chan)]
	}
}




putlog "clonednicks.tcl ver 0.1 by SpiKe^^ Loaded."

i tried to utilize

set key [string tolower [string range $nick 0 4]]

not sure i did it proper tho as it doesnt set ban on that as well
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

clonednicks.tcl ver 0.2 by SpiKe^^

Post by SpiKe^^ »

Updeted script with mode +R lock and partial nick ban?

Code: Select all

#### clonednicks.tcl ver 0.2 by SpiKe^^ (25Nov2021) ####


bind join - * join:clonednicks

proc join:clonednicks {nick uhost hand chan} {
  global cnicks cnickq

  if {[isbotnick $nick] || ([string length $nick] < 6)} { return 0 }
  if {[matchattr $hand f|f $chan]} { return 0 }

  set chan [string tolower $chan]
  set key [string tolower [string range $nick 0 4]]
  set now [clock milliseconds]

  if {[info exists cnicks(${key},$chan)]} {
    ## just expire any old entries ##
    set old [expr {$now - (3 * 1000)}]
    set newls [list]
    foreach joined $cnicks(${key},$chan) {
      if {[lindex [split $joined ","] 1] > $old} { lappend newls $joined }
    }
    if {![llength $newls]} {  unset cnicks(${key},$chan)
    } else {  set cnicks(${key},$chan) $newls  }
  }
  if {![info exists cnicks(${key},$chan)]} {
    set cnicks(${key},$chan) [list "0,${now},${nick}!$uhost"]
    return 0
  }

  if {![info exists cnickq($chan)]} {
    after 1000 [list dobans:clonednicks $chan]

    dobans:lockchan $chan $key

  }
  if {[string match "0,*" [set first [lindex $cnicks(${key},$chan) 0]]]} {
    set cnicks(${key},$chan) [list "1,[string range $first 2 end]"]
    lappend cnickq($chan) [lindex [split $first ","] 2]
  }

  lappend cnicks(${key},$chan) "1,${now},${nick}!$uhost"
  lappend cnickq($chan) "${nick}!$uhost"
  return 0
}


proc dobans:clonednicks {chan} {
  global cnickq

  if {![info exists cnickq($chan)]} { return 0 }
  if {![llength $cnickq($chan)] || ![botisop $chan]} {
    unset cnickq($chan)  ;  return 0
  }

  set bmasks [list]  ;  set knicks [list]
  foreach nkuhost $cnickq($chan) {
    lassign [split $nkuhost "!@"] n u h
    lappend knicks $n
    lappend bmasks *!*@$h
  }

  set max 10
  while {[set len [llength $bmasks]] > 0} {
    if {$len > $max} {
      set mode [string repeat "b" $max]
      set masks [join [lrange $bmasks 0 [expr {$max - 1}]]]
      set bmasks [lrange $bmasks $max end]
    } else {
      set mode [string repeat "b" $len]
      set masks [join $bmasks]
      set bmasks ""
    }
    putquick "MODE $chan +$mode $masks"
  }

  set max 4
  while {[set len [llength $knicks]] > 0} {
    if {$len > $max} {
      set nicks [join [lrange $knicks 0 [expr {$max - 1}]] ","]
      set knicks [lrange $knicks $max end]
    } else {
      set nicks [join $knicks ","]
      set knicks ""
    }
    putserv "KICK $chan $nicks :!!! Indentical nicks !!!"
  }

  unset cnickq($chan)  ;  return 0
}


bind cron - {*/10 * * * *} cleanup:clonednicks

proc cleanup:clonednicks {mn hr da mo wd} {
  global cnicks
  set old [expr {[clock milliseconds] - (3 * 1000)}]

  foreach {key val} [array get cnicks] {
    set newls [list]
    foreach joined $val {
      if {[lindex [split $joined ","] 1] > $old} { lappend newls $joined }
    }
    if {![llength $newls]} {  unset cnicks($key)
    } else {  set cnicks($key) $newls  }
  }
}


proc dobans:lockchan {chan key} {
  global cnick_flooded

  if {![info exists cnick_flooded($chan)]} {
    set cnick_flooded($chan) 1
    putquick "MODE $chan +Rb ${key}*!*@*"
    utimer 10 [list putquick "MODE $chan -R"]
    utimer 10 [list unset -nocomplain ::cnick_flooded($chan)]
  }
}

putlog "clonednicks.tcl ver 0.2 by SpiKe^^ Loaded."

SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Post Reply