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 

Detecting identical nicks within time frame
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Wed Nov 24, 2021 4:21 pm    Post subject: Reply with quote

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


Joined: 22 Mar 2015
Posts: 941

PostPosted: Wed Nov 24, 2021 4:32 pm    Post subject: Reply with quote

tested again with 10 clones it took like 10 seconds to get them
Back to top
View user's profile Send private message
SpiKe^^
Owner


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

PostPosted: Thu Nov 25, 2021 12:28 am    Post subject: fixed variable name Reply with quote

FIXED a variable naming issue from some reused code in proc dobans:clonednicks in the script post above.
Code:
    ##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
.
Back to top
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Thu Nov 25, 2021 1:31 am    Post subject: Re: fixed variable name Reply with quote

SpiKe^^ wrote:
FIXED a variable naming issue from some reused code in proc dobans:clonednicks in the script post above.
Code:
    ##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
Back to top
View user's profile Send private message
SpiKe^^
Owner


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

PostPosted: Thu Nov 25, 2021 1:39 am    Post subject: Reply with quote

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


Joined: 22 Mar 2015
Posts: 941

PostPosted: Thu Nov 25, 2021 2:46 am    Post subject: Reply with quote

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


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

PostPosted: Thu Nov 25, 2021 9:40 am    Post subject: Reply with quote

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


Joined: 22 Mar 2015
Posts: 941

PostPosted: Thu Nov 25, 2021 10:10 am    Post subject: Reply with quote

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


Quote:

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


Joined: 22 Mar 2015
Posts: 941

PostPosted: Thu Nov 25, 2021 10:18 am    Post subject: Reply with quote

anyway to have it react instant non opered as well ?
Back to top
View user's profile Send private message
SpiKe^^
Owner


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

PostPosted: Thu Nov 25, 2021 10:36 am    Post subject: Reply with quote

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


Joined: 22 Mar 2015
Posts: 941

PostPosted: Thu Nov 25, 2021 11:30 am    Post subject: Reply with quote

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


Joined: 22 Mar 2015
Posts: 941

PostPosted: Thu Nov 25, 2021 11:39 am    Post subject: Reply with quote

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


Joined: 22 Mar 2015
Posts: 941

PostPosted: Thu Nov 25, 2021 12:03 pm    Post subject: Reply with quote

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


Joined: 22 Mar 2015
Posts: 941

PostPosted: Thu Nov 25, 2021 12:52 pm    Post subject: Reply with quote

Code:


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


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

PostPosted: Thu Nov 25, 2021 3:04 pm    Post subject: clonednicks.tcl ver 0.2 by SpiKe^^ Reply with quote

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

#### 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
.
Back to top
View user's profile Send private message Visit poster's website
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  Next
Page 2 of 3

 
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