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.

gline joinflood to snircd

Help for those learning Tcl or writing their own scripts.
Post Reply
d
darksis
Voice
Posts: 16
Joined: Sat Aug 04, 2012 8:17 am

gline joinflood to snircd

Post by darksis »

Hello i need please script about joinflood i see in this code

Code: Select all

bind flud - join foo
proc foo {n u args} {
   regsub {[^@]+} $u * u
   putserv "akill $u :abusive join flood"
} 
and i want to change command akill to gline like this

Code: Select all

/gline !+*@106.109.108.78 3600 :Localclone? 
gline+timer and resaon
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Let's just try this:

Code: Select all

bind flud - join foo 
proc foo {nk uh hn tp ch} { 
   regsub {[^@]+} $uh * uh 

   putserv "gline $uh 3600 :abusive join flood" 
   return 0

} 

Not sure if you need to 'return 1' or 'return 0'
If the proc returns 1, no further action is taken on the flood.
If the proc returns 0, the bot will do its normal "punishment" for the flood.
Let me know how that works out.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
d
darksis
Voice
Posts: 16
Joined: Sat Aug 04, 2012 8:17 am

Post by darksis »

:) thanks but i try code and is no work i try now connect 70 clones and all clone inside and no gline
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

That would imply the eggdrop join flood is not triggering, so that process is never being called.
Eggdrops' join flood only monitors for 'x' number of joins in 'x' seconds.

You need a script that will monitor for 'x' number of connections from the same host. That process you posted doesn't monitor for that:)

Search the egghelp.org script archive for a script that does clone checking, and maybe it can be modified to do the gline as the punishment method.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
d
darksis
Voice
Posts: 16
Joined: Sat Aug 04, 2012 8:17 am

Post by darksis »

ok i undestand but i think change in this code

Code: Select all

bind flud - join foo
proc foo {nk uh hn tp ch} {
   regsub {[^@]+} $uh * uh

   putserv "gline $uh 3600 :abusive join flood"
   return 0

}
gline on host like command like this

Code: Select all

putserv "gline !+*@106.109.108.78 3600 :Localclone?"
but i dont know if this possible
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

I already did, but it triggers off the eggdrop join flood which has no reference to clones. You need a script that will attempt to count the users from one host and ban/kick/gline/slap/kiss the joined users on that criteria. The eggdrop does not have any of that code, nor does the code you posted.

There are many channel control scripts in the archive that already do the clone checks, find one of them that functions and is close to what you want, then ask for the gline patch to that scripts punishment method.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

From the egghelp.org script archive:

Clone Scanner 5.90.b 09/08/2007 awyeah
http://www.egghelp.org/cgi-bin/tcl_arch ... ad&id=1464
Eliminates excessive clones residing in a channel (checks: on channel join and on continuous intervals). Clones are detected in the format of: *!*@host.domain.com. Includes op/voice exemption from clone scanning. Also exempts vhosts (virtual hosts) from being detected as clones.

This looks like a nicer start to your clone checking woes. Make sure it does work and trigger on the issue you are trying to address, then maybe someone can help change its punishment method.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
d
darksis
Voice
Posts: 16
Joined: Sat Aug 04, 2012 8:17 am

Post by darksis »

spike thanks for help but this code i need

Code: Select all

on *:snotice:*Client connecting*:{
  if ($network != mIRCx) { return }
  var %ip = $iif($regex($10,/(\d+\.\d+\.\d+\.\d+)/),$regml(1),1)
  if (!$hget(Botnet,$9)) { hadd -mu4 Botnet $9 %ip }
  if ($hget(Botnet,0).item >= 3) {
    var %x 1
    while ($hget(Botnet,%x).item) {
      dll WhileFix.dll WhileFix .
      gline $ifmatch - :Abuse - Botnets Flood!
      hdel -w Botnet $ifmatch     
      inc %x
    }
  }
}
this code i need for bot if someone put many client connect
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

That's mIRC code, with the help of a dll file that's not there.... there is no ready available tcl code to pull that off with the eggdrop and tcl.

I'm now working on an eggdrop clone checker script myself, the one I posted the link to has some ugly/questionable code in it. Hope to have it ready in a day or so.

Did you even look at or try the script from from the archive?? An eggdrop tcl script to do channel clone checking will be much larger than that few line mirc script you posted.
Last edited by SpiKe^^ on Sun Dec 09, 2012 5:39 pm, edited 1 time in total.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
d
darksis
Voice
Posts: 16
Joined: Sat Aug 04, 2012 8:17 am

Post by darksis »

ok thanks for help
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Here's the first try, see if it runs:) I have not tested on it any yet.

Code: Select all

# On-Join Clone Checker Version 0.1 #

# author:  SpiKe^^ #
# e-mail:  spike<at>mytclscripts<dot>com #
# webpage: http://mytclscripts.com/ #

# this script requires EGGDROP v1.6.17 or higher #
# this script requires TCL v8.4 or higher #

########################################################################
# This file is loosely based on: Clone Scanner v5.90.b [clonescan.tcl] #
#                    Build date: 23rd July 2007                        #
#               Copyright © 1998-2007 awyeah (awesomeawyeah@gmail.com) #
# and carries all the same Copyright terms as that script.             #
########################################################################
#                                                                      #
# Copyright (C) 2012  SpiKe^^                                          #
#                                                                      #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or    #
# (at your option) any later version.                                  #
#                                                                      #
# This program is distributed in the hope that it will be useful,      #
# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #
# GNU General Public License for more details.                         #
#                                                                      #
# For a complete copy of the GNU General Public License go to:         #
# http://www.gnu.org/copyleft/gpl.html                                 #
#                                                                      #
########################################################################

############################### Begin Settings ##############################

# Set the channel(s) to monitor on-join for clones. #
# Set this to {*} to monitor all channels the bot is on.
# Set this to {}  to disable this script.
set ojClone(join-chan) {#yourchannel #anotherchannel}

# Set the number of clones that would trigger this script. #
# Punish the host when the number of clones equal or excede this number.
# Clones are detected & punished by this format:  *!*@host.domain.com    
set ojClone(punish-at) "4"   ;# (Valid Settings: any number 2 or more)

# Set the 'number of Seconds' to delay the clone check after a join. #
# In a mass join, this may keep the checker from having to run for each join.
# May also allow time for users to gain ops/voice for the (xmpt-ops) option.
set ojClone(delay-time) "6"   ;# (Valid Settings: a number 3 to 30)

########################### Exempt Users Settings ###########################

# Set user file flags to exempt from clone checking. ( global|channel ) #
# Set this "" to disable user file flag checking.
set ojClone(xmpt-flags) "bmn|mn"

# If (xmpt-flags) above is on: exempt all clones from the exempt users host ? #
# 0 = no, just exempt the nick with matching flags & count clones from host.
# 1 = yes, exempt all clones from any user that matches any of these flags.
set ojClone(xmptf-all) "1"   ;# (Valid Settings: 0 or 1)

# Exempt users with op and/or voice in the channel from clone checking ?? #
# Set this to "0" to not exempt users for ops or voice in the channel.
# 1 = exempt ops only  |  2 = exempt voice only  |  3 = exempt ops and voice
set ojClone(xmpt-ops) "3"   ;# (Valid Settings: a number 0 to 3)

# If (xmpt-ops) above is on: exempt all clones from ops/voice in channel ? #
# 0 = no, just exempt the nick with ops/voice & count other clones from host.
# 1 = yes, exempt all clones from any user that has ops/voice in the channel.
set ojClone(xmpto-all) "1"   ;# (Valid Settings: 0 or 1)

# Set specific host masks to exempt from clone checking. #
########## Host Mask Tips ##########
# Put each exempt host mask on its own line.
# Mask format: nick!ident@host.com  :or:  nick!ident@123.45.67.89
# Allows wildcards: '*' matches 0 or more chars, '?' matches any single char.
####### Exempt Hosts Example #######
# set ojClone(xmpt-hosts) {
# *!*@DALnet
# *!*@*.users.quakenet.org
# *!*@123.45.67.*
# }
##########
# Leave this empty to disable exempt host mask checking. #
set ojClone(xmpt-hosts) {

}  ;## end of exempt hosts ##

######################### Excess Clones Punishments #########################

# Do you want to set a channel ban for affected host ?? (0=no | 1=yes) #
set ojClone(do-ban) "0"   ;# (Valid Settings: 0 or 1)

# If (do-ban) above is on: set the 'number of Minutes' for the ban. #
# Set this "0" to allow the irc server to expire the ban (usually 60 min).
set ojClone(ban-time) "1"   ;# (Valid Settings: a number 0 to 60)

# Do you want to kick all the affected nicks ?? (0=no | 1=yes) #
set ojClone(do-kick) "0"   ;# (Valid Settings: 0 or 1)

# If (do-kick) above is on: set the 'reason' to use with the kick. #
set ojClone(kick-resn) {Excess Clones!}

##################### Advanced Excess Clones Punishment #####################

# If the bot has IRC Operator status, the script can KLINE/GLINE the host. #
# Do you want to KLINE or GLINE the affected host ??  (0=no | 1=yes)
set ojClone(do-kline) "1"   ;# (Valid Settings: 0 or 1)

# If (do-kline) above is on: set the KLINE/GLINE command used on your server. #
# For example, some ircd servers use:   kline %mask %time %reason
# Others use:   kline %time %mask %reason   :or just:   kline %mask %reason
# NOTES: You MUST use the correct command(s) for the ircd server the bot is on!
#      : Some ircd commands don't allow for a removal time, If you want this
#        script to remove the kline/etc., set the removal command below.
######### Variable Substitutions #########
# %mask   = the klined/glined mask.
# %time   = the kline/gline time. 
# %reason = the kline/gline reason.
########## Some Other Examples ##########
# GLINE +%mask %time %reason
# GLINE %mask %time :%reason
# ZLINE +%mask %time %reason
# TKLINE %mask %time :%reason
##########
set ojClone(kline-cmd) "gline +%mask %time :%reason"

# Set the Reason text to use for the %reason code in (kline-cmd) above. #
set ojClone(kl-reason) {Excess Clones!}

# If (do-kline) above is on: set 'number of Minutes' for the KLINE/GLINE. #
# A time of "0" for the KLINE or GLINE makes it permanent (Never Expires).
# Note: script will convert to seconds, if needed, for %time replacement.
set ojClone(kline-time) "60"   ;# (Valid Settings: any number 0 or more)

# If (do-kline) is on: does ircd use minutes or seconds for K/GLINE time ? #
# 1 = Minutes: script uses (kline-time) as is, for %time in (kline-cmd).
# 2 = Seconds: script converts (kline-time) to seconds, for %time substitution.
set ojClone(kl-min-sec) "2"   ;# (Valid Settings: 1 or 2)

# If (do-kline) is on: do you want this script to remove the KLINE/GLINE ? #
# Leave this empty if (kline-cmd) above uses the %time code in the command.
# Leave this empty if KLINE/GLINE is permanent or you will remove yourself.
# Or set this to the remove command the script should use after (kline-time).
########## Some Remove Examples ##########
# KLINE -%mask
# UNKLINE %mask
# GLINE -%mask
# ZLINE -%mask
##########
set ojClone(kl-rem-cmd) ""

############################## End Of Settings #############################
#### End Settings #### End Settings #### End Settings #### End Settings ####


set ojClone(ver) 0.1
set ojClone(join-chan) [string trim $ojClone(join-chan)]
if {$ojClone(join-chan) eq ""} {
  proc ojccUnload {} {  global ojClone
    catch {unbind join - * ojccOnJoin}
    foreach {name valu} [array get ojClone #*] {  catch {killutimer $valu}  }
    catch {rename ojccOnJoin ""}
    catch {rename ojccDoCheck ""}
    putlog "On-Join Clone Checker Ver. $ojClone(ver) by SpiKe^^ is Disabled."
    unset ojClone  ;  return
  }
  ojccUnload  ;  rename ojccUnload ""  ;  return
}

if {$ojClone(join-chan) ne "*"} {
  set ojClone(join-chan) [split [string tolower $ojClone(join-chan)]]
} else {  set ojClone(join-chan) [split [string tolower [join [channels]]]]  }
set ojClone(ban-time) [expr {$ojClone(ban-time)*60}]
if {![string match *%mask* $ojClone(kline-cmd)]} {  set ojClone(do-kline) 0  }
if {$ojClone(do-kline)=="1"} {
  set ojClone(kline-time) [expr {$ojClone(kline-time)*60}]
  if {[string match *%time* $ojClone(kline-cmd)]} {
    if {$ojClone(kl-min-sec)=="1"} {
      set ojClone(kline-time) [expr {$ojClone(kline-time)/60}]
    }
    set ojClone(kl-rem-cmd) ""
  }
}
set ojClone(xmpt-flags) [string trim $ojClone(xmpt-flags)]
set ojClone(xmpt-hosts) [string trim $ojClone(xmpt-hosts)]
set ojClone(xmpt-hosts) [split [string tolower $ojClone(xmpt-hosts)] "\n"]
if {![string is digit -strict $ojClone(xmpt-ops)] || $ojClone(xmpt-ops)>"3"} {
  set ojClone(xmpt-ops) 3
}
bind join - * ojccOnJoin

proc ojccOnJoin {nk uh hn ch} {  set ch [string tolower $ch]
  if {[isbotnick $nk]} {  return  }
  if {[lsearch -exact $::ojClone(join-chan) $ch]=="-1"} {  return  }
  if {$hn ne "*" && $::ojClone(xmpt-flags) ne ""} {
    if {[matchattr $hn $::ojClone(xmpt-flags) $ch]} {  return  }
  }
  if {[llength $::ojClone(xmpt-hosts)]>"0"} {
    foreach host $::ojClone(xmpt-hosts) {
      if {$host ne "" && [string match -nocase $host $nk!$uh]} {  return  }
    }
  }
  if {![info exists ::ojClone($ch)]} {
    set ::ojClone($ch) [utimer $::ojClone(delay-time) [list ojccDoCheck $ch]]
  }
  return
}

proc ojccDoCheck {ch} {  global ojClone
  unset ojClone($ch)
  if {![botonchan $ch]} {  return  }
  set chanls [chanlist $ch]
  if {[lsearch -exact $ojClone(join-chan) $ch]=="-1"} {  return  }
  if {[llength $chanls]<[expr {$ojClone(punish-at)+1}]} {  return  }

  set xf $ojClone(xmpt-flags)  ;  set xfa ojClone(xmptf-all)
  set xo $ojClone(xmpt-ops)  ;  set xoa ojClone(xmpto-all)
  set userls [list]  ;  set xmptls $ojClone(xmpt-hosts)
  foreach nk $chanls {
    if {[isbotnick $nk]} {  continue  }
    set hn [nick2hand $nk $ch]  ;  if {$hn eq ""} {  continue  }
    set uh [split [string tolower [getchanhost $nk $ch]] @]
    set hs [lindex $uh 1]  ;  set rn [lindex $uh 0]
    set xbyf 0  ;  set xbyo 0
    if {$xf ne "" && $hn ne "*" && [matchattr $hn $xf $ch]} {  set xbyf 1  }
    if {($xo == "1" || $xo == "3") && [isop $nk $ch]} {  set xbyo 1
    } elseif {$xo > "1" && [isvoice $nk $ch]} {  set xbyo 1  }
    set addtouser 1  ;  set addtoxmpt 0
    if {$xbyf=="1"} {
      if {$xfa=="0"} {  set addtouser 0  } else {  set addtoxmpt 1  }
    }
    if {$xbyo=="1"} {
      if {$xoa=="0"} {  set addtouser 0  } else {  set addtoxmpt 1  }
    }
    if {$addtouser=="1" && $addtoxmpt=="1"} {  set addtouser 0  }
    if {$addtouser=="1"} {  lappend userls $nk $rn $hs  }
    if {$addtoxmpt=="1"} {  lappend xmptls *!*@$hs  }
  }
  if {[llength $userls]<[expr {$ojClone(punish-at)*3}]} {  return  }
  unset chanls

  if {[llength $xmptls]>"0"} {
    set xmptls [lsort -unique $xmptls]  ;  set tmpls [list]
    foreach {nk rn hs} $userls {
      set usr [string tolower $nk]!$rn@$hs  ;  set isx 0
      foreach xmask $xmptls {
        if {[string match $xmask $usr]} {  set isx 1  ;  break  }
      }
      if {$isx=="0"} {  lappend tmpls $nk $rn $hs  }
    }
    set userls $tmpls  ;  unset tmpls xmptls
    if {[llength $userls]<[expr {$ojClone(punish-at)*3}]} {  return  }
  }

  set chostls [list]
  foreach {nk rn hs} $userls {
    if {[info exists count($hs)]} {  incr count($hs)
      if {$count($hs)==$ojClone(punish-at)} {  lappend chostls *@$hs  }
    } else {  set count($hs) 1  }
  }
  if {[llength $chostls]=="0"} {  return  }

  set clonels [list]
  foreach {nk rn hs} $userls {
    if {$count($hs)>=$ojClone(punish-at)} {  lappend clonels $nk  }
  }
  unset count userls

  if {$ojClone(do-kline)=="1"} {
    lappend map %time $ojClone(kline-time) %reason $ojClone(kl-reason)
    set ojClone(kline-cmd) [string map $map $ojClone(kline-cmd)]
    foreach hs $chostls {
      putquick [string map [list %mask $hs] $ojClone(kline-cmd)]
    }
    if {[string match *%mask* $ojClone(kl-rem-cmd)]} {
      utimer $ojClone(kline-time) [list ojccRemove kln $chostls $ch]
    }
  }
  if {![botisop $ch] && ![botishalfop $ch]} {  return  }
  if {$ojClone(do-ban)=="1"} {  set bhostls [list]
    foreach hs $chostls {  set hs *!$hs
      if {![ischanban $hs $ch]} {
        pushmode $ch +b $hs  ;  lappend bhostls $hs
      }
    }
    if {[llength $bhostls]>"0"} {  flushmode $ch
      if {$ojClone(ban-time)>"0"} {
        utimer $ojClone(ban-time) [list ojccRemove ban $bhostls $ch]
      }
    }
  }
  if {$ojClone(do-kick)=="1"} {  set knickls [list]
    foreach nk $clonels {
      if {[onchan $nk $ch]} {  lappend knickls $nk  }
    }
    if {[llength $knickls]>"0"} {
      if {$ojClone(kick-resn) eq ""} {
        set ojClone(kick-resn) "On-Join Clone Checker by SpiKe^^"
      }
      putkick $ch [join $knickls ,] $ojClone(kick-resn)
    }
  }
  return
}

proc ojccRemove {wat rls ch} {
  if {$wat eq "kln"} {
    foreach hs $rls {
      putserv [string map [list %mask $hs] $::ojClone(kl-rem-cmd)]
    }
    return
  }
  if {![botonchan $ch]} {  return  }
  if {![botisop $ch] && ![botishalfop $ch]} {  return  }
  foreach hs $rls {
    if {![ischanban $hs $ch]} {  pushmode $ch -b $hs  }
  }
  return
}

putlog "On-Join Clone Checker ver. $ojClone(ver) by SpiKe^^ loaded."

GoodLuck, Let Me Know.
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

Re:

Post by simo »

SpiKe^^ wrote: Wed Dec 12, 2012 9:07 pm Here's the first try, see if it runs:) I have not tested on it any yet.

Code: Select all

# On-Join Clone Checker Version 0.1 #

# author:  SpiKe^^ #
# e-mail:  spike<at>mytclscripts<dot>com #
# webpage: http://mytclscripts.com/ #

# this script requires EGGDROP v1.6.17 or higher #
# this script requires TCL v8.4 or higher #

########################################################################
# This file is loosely based on: Clone Scanner v5.90.b [clonescan.tcl] #
#                    Build date: 23rd July 2007                        #
#               Copyright © 1998-2007 awyeah (awesomeawyeah@gmail.com) #
# and carries all the same Copyright terms as that script.             #
########################################################################
#                                                                      #
# Copyright (C) 2012  SpiKe^^                                          #
#                                                                      #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or    #
# (at your option) any later version.                                  #
#                                                                      #
# This program is distributed in the hope that it will be useful,      #
# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #
# GNU General Public License for more details.                         #
#                                                                      #
# For a complete copy of the GNU General Public License go to:         #
# http://www.gnu.org/copyleft/gpl.html                                 #
#                                                                      #
########################################################################

############################### Begin Settings ##############################

# Set the channel(s) to monitor on-join for clones. #
# Set this to {*} to monitor all channels the bot is on.
# Set this to {}  to disable this script.
set ojClone(join-chan) {#yourchannel #anotherchannel}

# Set the number of clones that would trigger this script. #
# Punish the host when the number of clones equal or excede this number.
# Clones are detected & punished by this format:  *!*@host.domain.com    
set ojClone(punish-at) "4"   ;# (Valid Settings: any number 2 or more)

# Set the 'number of Seconds' to delay the clone check after a join. #
# In a mass join, this may keep the checker from having to run for each join.
# May also allow time for users to gain ops/voice for the (xmpt-ops) option.
set ojClone(delay-time) "6"   ;# (Valid Settings: a number 3 to 30)

########################### Exempt Users Settings ###########################

# Set user file flags to exempt from clone checking. ( global|channel ) #
# Set this "" to disable user file flag checking.
set ojClone(xmpt-flags) "bmn|mn"

# If (xmpt-flags) above is on: exempt all clones from the exempt users host ? #
# 0 = no, just exempt the nick with matching flags & count clones from host.
# 1 = yes, exempt all clones from any user that matches any of these flags.
set ojClone(xmptf-all) "1"   ;# (Valid Settings: 0 or 1)

# Exempt users with op and/or voice in the channel from clone checking ?? #
# Set this to "0" to not exempt users for ops or voice in the channel.
# 1 = exempt ops only  |  2 = exempt voice only  |  3 = exempt ops and voice
set ojClone(xmpt-ops) "3"   ;# (Valid Settings: a number 0 to 3)

# If (xmpt-ops) above is on: exempt all clones from ops/voice in channel ? #
# 0 = no, just exempt the nick with ops/voice & count other clones from host.
# 1 = yes, exempt all clones from any user that has ops/voice in the channel.
set ojClone(xmpto-all) "1"   ;# (Valid Settings: 0 or 1)

# Set specific host masks to exempt from clone checking. #
########## Host Mask Tips ##########
# Put each exempt host mask on its own line.
# Mask format: nick!ident@host.com  :or:  nick!ident@123.45.67.89
# Allows wildcards: '*' matches 0 or more chars, '?' matches any single char.
####### Exempt Hosts Example #######
# set ojClone(xmpt-hosts) {
# *!*@DALnet
# *!*@*.users.quakenet.org
# *!*@123.45.67.*
# }
##########
# Leave this empty to disable exempt host mask checking. #
set ojClone(xmpt-hosts) {

}  ;## end of exempt hosts ##

######################### Excess Clones Punishments #########################

# Do you want to set a channel ban for affected host ?? (0=no | 1=yes) #
set ojClone(do-ban) "0"   ;# (Valid Settings: 0 or 1)

# If (do-ban) above is on: set the 'number of Minutes' for the ban. #
# Set this "0" to allow the irc server to expire the ban (usually 60 min).
set ojClone(ban-time) "1"   ;# (Valid Settings: a number 0 to 60)

# Do you want to kick all the affected nicks ?? (0=no | 1=yes) #
set ojClone(do-kick) "0"   ;# (Valid Settings: 0 or 1)

# If (do-kick) above is on: set the 'reason' to use with the kick. #
set ojClone(kick-resn) {Excess Clones!}

##################### Advanced Excess Clones Punishment #####################

# If the bot has IRC Operator status, the script can KLINE/GLINE the host. #
# Do you want to KLINE or GLINE the affected host ??  (0=no | 1=yes)
set ojClone(do-kline) "1"   ;# (Valid Settings: 0 or 1)

# If (do-kline) above is on: set the KLINE/GLINE command used on your server. #
# For example, some ircd servers use:   kline %mask %time %reason
# Others use:   kline %time %mask %reason   :or just:   kline %mask %reason
# NOTES: You MUST use the correct command(s) for the ircd server the bot is on!
#      : Some ircd commands don't allow for a removal time, If you want this
#        script to remove the kline/etc., set the removal command below.
######### Variable Substitutions #########
# %mask   = the klined/glined mask.
# %time   = the kline/gline time. 
# %reason = the kline/gline reason.
########## Some Other Examples ##########
# GLINE +%mask %time %reason
# GLINE %mask %time :%reason
# ZLINE +%mask %time %reason
# TKLINE %mask %time :%reason
##########
set ojClone(kline-cmd) "gline +%mask %time :%reason"

# Set the Reason text to use for the %reason code in (kline-cmd) above. #
set ojClone(kl-reason) {Excess Clones!}

# If (do-kline) above is on: set 'number of Minutes' for the KLINE/GLINE. #
# A time of "0" for the KLINE or GLINE makes it permanent (Never Expires).
# Note: script will convert to seconds, if needed, for %time replacement.
set ojClone(kline-time) "60"   ;# (Valid Settings: any number 0 or more)

# If (do-kline) is on: does ircd use minutes or seconds for K/GLINE time ? #
# 1 = Minutes: script uses (kline-time) as is, for %time in (kline-cmd).
# 2 = Seconds: script converts (kline-time) to seconds, for %time substitution.
set ojClone(kl-min-sec) "2"   ;# (Valid Settings: 1 or 2)

# If (do-kline) is on: do you want this script to remove the KLINE/GLINE ? #
# Leave this empty if (kline-cmd) above uses the %time code in the command.
# Leave this empty if KLINE/GLINE is permanent or you will remove yourself.
# Or set this to the remove command the script should use after (kline-time).
########## Some Remove Examples ##########
# KLINE -%mask
# UNKLINE %mask
# GLINE -%mask
# ZLINE -%mask
##########
set ojClone(kl-rem-cmd) ""

############################## End Of Settings #############################
#### End Settings #### End Settings #### End Settings #### End Settings ####


set ojClone(ver) 0.1
set ojClone(join-chan) [string trim $ojClone(join-chan)]
if {$ojClone(join-chan) eq ""} {
  proc ojccUnload {} {  global ojClone
    catch {unbind join - * ojccOnJoin}
    foreach {name valu} [array get ojClone #*] {  catch {killutimer $valu}  }
    catch {rename ojccOnJoin ""}
    catch {rename ojccDoCheck ""}
    putlog "On-Join Clone Checker Ver. $ojClone(ver) by SpiKe^^ is Disabled."
    unset ojClone  ;  return
  }
  ojccUnload  ;  rename ojccUnload ""  ;  return
}

if {$ojClone(join-chan) ne "*"} {
  set ojClone(join-chan) [split [string tolower $ojClone(join-chan)]]
} else {  set ojClone(join-chan) [split [string tolower [join [channels]]]]  }
set ojClone(ban-time) [expr {$ojClone(ban-time)*60}]
if {![string match *%mask* $ojClone(kline-cmd)]} {  set ojClone(do-kline) 0  }
if {$ojClone(do-kline)=="1"} {
  set ojClone(kline-time) [expr {$ojClone(kline-time)*60}]
  if {[string match *%time* $ojClone(kline-cmd)]} {
    if {$ojClone(kl-min-sec)=="1"} {
      set ojClone(kline-time) [expr {$ojClone(kline-time)/60}]
    }
    set ojClone(kl-rem-cmd) ""
  }
}
set ojClone(xmpt-flags) [string trim $ojClone(xmpt-flags)]
set ojClone(xmpt-hosts) [string trim $ojClone(xmpt-hosts)]
set ojClone(xmpt-hosts) [split [string tolower $ojClone(xmpt-hosts)] "\n"]
if {![string is digit -strict $ojClone(xmpt-ops)] || $ojClone(xmpt-ops)>"3"} {
  set ojClone(xmpt-ops) 3
}
bind join - * ojccOnJoin

proc ojccOnJoin {nk uh hn ch} {  set ch [string tolower $ch]
  if {[isbotnick $nk]} {  return  }
  if {[lsearch -exact $::ojClone(join-chan) $ch]=="-1"} {  return  }
  if {$hn ne "*" && $::ojClone(xmpt-flags) ne ""} {
    if {[matchattr $hn $::ojClone(xmpt-flags) $ch]} {  return  }
  }
  if {[llength $::ojClone(xmpt-hosts)]>"0"} {
    foreach host $::ojClone(xmpt-hosts) {
      if {$host ne "" && [string match -nocase $host $nk!$uh]} {  return  }
    }
  }
  if {![info exists ::ojClone($ch)]} {
    set ::ojClone($ch) [utimer $::ojClone(delay-time) [list ojccDoCheck $ch]]
  }
  return
}

proc ojccDoCheck {ch} {  global ojClone
  unset ojClone($ch)
  if {![botonchan $ch]} {  return  }
  set chanls [chanlist $ch]
  if {[lsearch -exact $ojClone(join-chan) $ch]=="-1"} {  return  }
  if {[llength $chanls]<[expr {$ojClone(punish-at)+1}]} {  return  }

  set xf $ojClone(xmpt-flags)  ;  set xfa ojClone(xmptf-all)
  set xo $ojClone(xmpt-ops)  ;  set xoa ojClone(xmpto-all)
  set userls [list]  ;  set xmptls $ojClone(xmpt-hosts)
  foreach nk $chanls {
    if {[isbotnick $nk]} {  continue  }
    set hn [nick2hand $nk $ch]  ;  if {$hn eq ""} {  continue  }
    set uh [split [string tolower [getchanhost $nk $ch]] @]
    set hs [lindex $uh 1]  ;  set rn [lindex $uh 0]
    set xbyf 0  ;  set xbyo 0
    if {$xf ne "" && $hn ne "*" && [matchattr $hn $xf $ch]} {  set xbyf 1  }
    if {($xo == "1" || $xo == "3") && [isop $nk $ch]} {  set xbyo 1
    } elseif {$xo > "1" && [isvoice $nk $ch]} {  set xbyo 1  }
    set addtouser 1  ;  set addtoxmpt 0
    if {$xbyf=="1"} {
      if {$xfa=="0"} {  set addtouser 0  } else {  set addtoxmpt 1  }
    }
    if {$xbyo=="1"} {
      if {$xoa=="0"} {  set addtouser 0  } else {  set addtoxmpt 1  }
    }
    if {$addtouser=="1" && $addtoxmpt=="1"} {  set addtouser 0  }
    if {$addtouser=="1"} {  lappend userls $nk $rn $hs  }
    if {$addtoxmpt=="1"} {  lappend xmptls *!*@$hs  }
  }
  if {[llength $userls]<[expr {$ojClone(punish-at)*3}]} {  return  }
  unset chanls

  if {[llength $xmptls]>"0"} {
    set xmptls [lsort -unique $xmptls]  ;  set tmpls [list]
    foreach {nk rn hs} $userls {
      set usr [string tolower $nk]!$rn@$hs  ;  set isx 0
      foreach xmask $xmptls {
        if {[string match $xmask $usr]} {  set isx 1  ;  break  }
      }
      if {$isx=="0"} {  lappend tmpls $nk $rn $hs  }
    }
    set userls $tmpls  ;  unset tmpls xmptls
    if {[llength $userls]<[expr {$ojClone(punish-at)*3}]} {  return  }
  }

  set chostls [list]
  foreach {nk rn hs} $userls {
    if {[info exists count($hs)]} {  incr count($hs)
      if {$count($hs)==$ojClone(punish-at)} {  lappend chostls *@$hs  }
    } else {  set count($hs) 1  }
  }
  if {[llength $chostls]=="0"} {  return  }

  set clonels [list]
  foreach {nk rn hs} $userls {
    if {$count($hs)>=$ojClone(punish-at)} {  lappend clonels $nk  }
  }
  unset count userls

  if {$ojClone(do-kline)=="1"} {
    lappend map %time $ojClone(kline-time) %reason $ojClone(kl-reason)
    set ojClone(kline-cmd) [string map $map $ojClone(kline-cmd)]
    foreach hs $chostls {
      putquick [string map [list %mask $hs] $ojClone(kline-cmd)]
    }
    if {[string match *%mask* $ojClone(kl-rem-cmd)]} {
      utimer $ojClone(kline-time) [list ojccRemove kln $chostls $ch]
    }
  }
  if {![botisop $ch] && ![botishalfop $ch]} {  return  }
  if {$ojClone(do-ban)=="1"} {  set bhostls [list]
    foreach hs $chostls {  set hs *!$hs
      if {![ischanban $hs $ch]} {
        pushmode $ch +b $hs  ;  lappend bhostls $hs
      }
    }
    if {[llength $bhostls]>"0"} {  flushmode $ch
      if {$ojClone(ban-time)>"0"} {
        utimer $ojClone(ban-time) [list ojccRemove ban $bhostls $ch]
      }
    }
  }
  if {$ojClone(do-kick)=="1"} {  set knickls [list]
    foreach nk $clonels {
      if {[onchan $nk $ch]} {  lappend knickls $nk  }
    }
    if {[llength $knickls]>"0"} {
      if {$ojClone(kick-resn) eq ""} {
        set ojClone(kick-resn) "On-Join Clone Checker by SpiKe^^"
      }
      putkick $ch [join $knickls ,] $ojClone(kick-resn)
    }
  }
  return
}

proc ojccRemove {wat rls ch} {
  if {$wat eq "kln"} {
    foreach hs $rls {
      putserv [string map [list %mask $hs] $::ojClone(kl-rem-cmd)]
    }
    return
  }
  if {![botonchan $ch]} {  return  }
  if {![botisop $ch] && ![botishalfop $ch]} {  return  }
  foreach hs $rls {
    if {![ischanban $hs $ch]} {  pushmode $ch -b $hs  }
  }
  return
}

putlog "On-Join Clone Checker ver. $ojClone(ver) by SpiKe^^ loaded."

GoodLuck, Let Me Know.
Hope i can bump this old thread, ive used this code on dalnet and it proofed usefull but unfortunately the exempt section doesn't seem to work as expected wich resulted in many irccloud users gettin booted off the channel, and its too complicated for me to edit did a few attempts but no luck hope someone can edit it to work properly its a nice code and usefull
Thanks in advance.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Re: gline joinflood to snircd

Post by simo »

using it like this :

Code: Select all


# On-Join Clone Checker Version 0.1 #

# author:  SpiKe^^ #
# e-mail:  spike<at>mytclscripts<dot>com #
# webpage: http://mytclscripts.com/ #

# this script requires EGGDROP v1.6.17 or higher #
# this script requires TCL v8.4 or higher #

########################################################################
# This file is loosely based on: Clone Scanner v5.90.b [clonescan.tcl] #
#                    Build date: 23rd July 2007                        #
#               Copyright © 1998-2007 awyeah (awesomeawyeah@gmail.com) #
# and carries all the same Copyright terms as that script.             #
########################################################################
#                                                                      #
# Copyright (C) 2012  SpiKe^^                                          #
#                                                                      #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or    #
# (at your option) any later version.                                  #
#                                                                      #
# This program is distributed in the hope that it will be useful,      #
# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #
# GNU General Public License for more details.                         #
#                                                                      #
# For a complete copy of the GNU General Public License go to:         #
# http://www.gnu.org/copyleft/gpl.html                                 #
#                                                                      #
########################################################################

############################### Begin Settings ##############################

# Set the channel(s) to monitor on-join for clones. #
# Set this to {*} to monitor all channels the bot is on.
# Set this to {}  to disable this script.
#set ojClone(join-chan) {#yourchannel #anotherchannel}
set ojClone(join-chan) {*}

# Set the number of clones that would trigger this script. #
# Punish the host when the number of clones equal or excede this number.
# Clones are detected & punished by this format:  *!*@host.domain.com    
set ojClone(punish-at) "3"   ;# (Valid Settings: any number 2 or more)

# Set the 'number of Seconds' to delay the clone check after a join. #
# In a mass join, this may keep the checker from having to run for each join.
# May also allow time for users to gain ops/voice for the (xmpt-ops) option.
set ojClone(delay-time) "6"   ;# (Valid Settings: a number 3 to 30)

########################### Exempt Users Settings ###########################

# Set user file flags to exempt from clone checking. ( global|channel ) #
# Set this "" to disable user file flag checking.
set ojClone(xmpt-flags) "bmn|mn"

# If (xmpt-flags) above is on: exempt all clones from the exempt users host ? #
# 0 = no, just exempt the nick with matching flags & count clones from host.
# 1 = yes, exempt all clones from any user that matches any of these flags.
set ojClone(xmptf-all) "1"   ;# (Valid Settings: 0 or 1)

# Exempt users with op and/or voice in the channel from clone checking ?? #
# Set this to "0" to not exempt users for ops or voice in the channel.
# 1 = exempt ops only  |  2 = exempt voice only  |  3 = exempt ops and voice
set ojClone(xmpt-ops) "3"   ;# (Valid Settings: a number 0 to 3)

# If (xmpt-ops) above is on: exempt all clones from ops/voice in channel ? #
# 0 = no, just exempt the nick with ops/voice & count other clones from host.
# 1 = yes, exempt all clones from any user that has ops/voice in the channel.
set ojClone(xmpto-all) "1"   ;# (Valid Settings: 0 or 1)

# Set specific host masks to exempt from clone checking. #
########## Host Mask Tips ##########
# Put each exempt host mask on its own line.
# Mask format: nick!ident@host.com  :or:  nick!ident@123.45.67.89
# Allows wildcards: '*' matches 0 or more chars, '?' matches any single char.
####### Exempt Hosts Example #######
# set ojClone(xmpt-hosts) {
# *!*@DALnet
# *!*@*.users.quakenet.org
# *!*@123.45.67.*
# }
##########
# Leave this empty to disable exempt host mask checking. #
set ojClone(xmpt-hosts) {
    *!*@*.irccloud.com 
    *!*@*.mibbit.com
    *!*@*.clients.kiwiirc.com
    *!~qwebirc@*

}  ;## end of exempt hosts ##

######################### Excess Clones Punishments #########################

# Do you want to set a channel ban for affected host ?? (0=no | 1=yes) #
set ojClone(do-ban) "1"   ;# (Valid Settings: 0 or 1)

# If (do-ban) above is on: set the 'number of Minutes' for the ban. #
# Set this "0" to allow the irc server to expire the ban (usually 60 min).
set ojClone(ban-time) "0"   ;# (Valid Settings: a number 0 to 60)

# Do you want to kick all the affected nicks ?? (0=no | 1=yes) #
set ojClone(do-kick) "1"   ;# (Valid Settings: 0 or 1)

# If (do-kick) above is on: set the 'reason' to use with the kick. #
set ojClone(kick-resn) {Excess Clones!}

##################### Advanced Excess Clones Punishment #####################

# If the bot has IRC Operator status, the script can KLINE/GLINE the host. #
# Do you want to KLINE or GLINE the affected host ??  (0=no | 1=yes)
set ojClone(do-kline) "0"   ;# (Valid Settings: 0 or 1)

# If (do-kline) above is on: set the KLINE/GLINE command used on your server. #
# For example, some ircd servers use:   kline %mask %time %reason
# Others use:   kline %time %mask %reason   :or just:   kline %mask %reason
# NOTES: You MUST use the correct command(s) for the ircd server the bot is on!
#      : Some ircd commands don't allow for a removal time, If you want this
#        script to remove the kline/etc., set the removal command below.
######### Variable Substitutions #########
# %mask   = the klined/glined mask.
# %time   = the kline/gline time. 
# %reason = the kline/gline reason.
########## Some Other Examples ##########
# GLINE +%mask %time %reason
# GLINE %mask %time :%reason
# ZLINE +%mask %time %reason
# TKLINE %mask %time :%reason
##########
set ojClone(kline-cmd) "gline +%mask %time :%reason"

# Set the Reason text to use for the %reason code in (kline-cmd) above. #
set ojClone(kl-reason) {Excess Clones!}

# If (do-kline) above is on: set 'number of Minutes' for the KLINE/GLINE. #
# A time of "0" for the KLINE or GLINE makes it permanent (Never Expires).
# Note: script will convert to seconds, if needed, for %time replacement.
set ojClone(kline-time) "60"   ;# (Valid Settings: any number 0 or more)

# If (do-kline) is on: does ircd use minutes or seconds for K/GLINE time ? #
# 1 = Minutes: script uses (kline-time) as is, for %time in (kline-cmd).
# 2 = Seconds: script converts (kline-time) to seconds, for %time substitution.
set ojClone(kl-min-sec) "2"   ;# (Valid Settings: 1 or 2)

# If (do-kline) is on: do you want this script to remove the KLINE/GLINE ? #
# Leave this empty if (kline-cmd) above uses the %time code in the command.
# Leave this empty if KLINE/GLINE is permanent or you will remove yourself.
# Or set this to the remove command the script should use after (kline-time).
########## Some Remove Examples ##########
# KLINE -%mask
# UNKLINE %mask
# GLINE -%mask
# ZLINE -%mask
##########
set ojClone(kl-rem-cmd) ""

############################## End Of Settings #############################
#### End Settings #### End Settings #### End Settings #### End Settings ####


set ojClone(ver) 0.1
set ojClone(join-chan) [string trim $ojClone(join-chan)]
if {$ojClone(join-chan) eq ""} {
  proc ojccUnload {} {  global ojClone
    catch {unbind join - * ojccOnJoin}
    foreach {name valu} [array get ojClone #*] {  catch {killutimer $valu}  }
    catch {rename ojccOnJoin ""}
    catch {rename ojccDoCheck ""}
    putlog "On-Join Clone Checker Ver. $ojClone(ver) by SpiKe^^ is Disabled."
    unset ojClone  ;  return
  }
  ojccUnload  ;  rename ojccUnload ""  ;  return
}

if {$ojClone(join-chan) ne "*"} {
  set ojClone(join-chan) [split [string tolower $ojClone(join-chan)]]
} else {  set ojClone(join-chan) [split [string tolower [join [channels]]]]  }
set ojClone(ban-time) [expr {$ojClone(ban-time)*60}]
if {![string match *%mask* $ojClone(kline-cmd)]} {  set ojClone(do-kline) 0  }
if {$ojClone(do-kline)=="1"} {
  set ojClone(kline-time) [expr {$ojClone(kline-time)*60}]
  if {[string match *%time* $ojClone(kline-cmd)]} {
    if {$ojClone(kl-min-sec)=="1"} {
      set ojClone(kline-time) [expr {$ojClone(kline-time)/60}]
    }
    set ojClone(kl-rem-cmd) ""
  }
}
set ojClone(xmpt-flags) [string trim $ojClone(xmpt-flags)]
set ojClone(xmpt-hosts) [string trim $ojClone(xmpt-hosts)]
set ojClone(xmpt-hosts) [split [string tolower $ojClone(xmpt-hosts)] "\n"]
if {![string is digit -strict $ojClone(xmpt-ops)] || $ojClone(xmpt-ops)>"3"} {
  set ojClone(xmpt-ops) 3
}
bind join - * ojccOnJoin

proc ojccOnJoin {nk uh hn ch} {  set ch [string tolower $ch]
  if {[isbotnick $nk]} {  return  }
  if {[lsearch -exact $::ojClone(join-chan) $ch]=="-1"} {  return  }
  if {$hn ne "*" && $::ojClone(xmpt-flags) ne ""} {
    if {[matchattr $hn $::ojClone(xmpt-flags) $ch]} {  return  }
  }
  if {[llength $::ojClone(xmpt-hosts)]>"0"} {
    foreach host $::ojClone(xmpt-hosts) {
      if {$host ne "" && [string match -nocase $host $nk!$uh]} {  continue  }
    }
  }
  if {![info exists ::ojClone($ch)]} {
#  set ::ojClone($ch) [utimer $::ojClone(delay-time) [list ojccDoCheck $ch]]
    set ::ojClone($ch) [after 300 [list ojccDoCheck $ch]]
  }
  return
}

proc ojccDoCheck {ch} {  global ojClone
  unset ojClone($ch)
  if {![botonchan $ch]} {  return  }
  set chanls [chanlist $ch]
  if {[lsearch -exact $ojClone(join-chan) $ch]=="-1"} {  return  }
  if {[llength $chanls]<[expr {$ojClone(punish-at)+1}]} {  return  }

  set xf $ojClone(xmpt-flags)  ;  set xfa ojClone(xmptf-all)
  set xo $ojClone(xmpt-ops)  ;  set xoa ojClone(xmpto-all)
  set userls [list]  ;  set xmptls $ojClone(xmpt-hosts)
  foreach nk $chanls {
    if {[isbotnick $nk]} {  continue  }
    set hn [nick2hand $nk $ch]  ;  if {$hn eq ""} {  continue  }
    set uh [split [string tolower [getchanhost $nk $ch]] @]
    set hs [lindex $uh 1]  ;  set rn [lindex $uh 0]
    set xbyf 0  ;  set xbyo 0
    if {$xf ne "" && $hn ne "*" && [matchattr $hn $xf $ch]} {  set xbyf 1  }
    if {($xo == "1" || $xo == "3") && [isop $nk $ch]} {  set xbyo 1
    } elseif {$xo > "1" && [isvoice $nk $ch]} {  set xbyo 1  }
    set addtouser 1  ;  set addtoxmpt 0
    if {$xbyf=="1"} {
      if {$xfa=="0"} {  set addtouser 0  } else {  set addtoxmpt 1  }
    }
    if {$xbyo=="1"} {
      if {$xoa=="0"} {  set addtouser 0  } else {  set addtoxmpt 1  }
    }
    if {$addtouser=="1" && $addtoxmpt=="1"} {  set addtouser 0  }
    if {$addtouser=="1"} {  lappend userls $nk $rn $hs  }
    if {$addtoxmpt=="1"} {  lappend xmptls *!*@$hs  }
  }
  if {[llength $userls]<[expr {$ojClone(punish-at)*3}]} {  return  }
  unset chanls

  if {[llength $xmptls]>"0"} {
    set xmptls [lsort -unique $xmptls]  ;  set tmpls [list]
    foreach {nk rn hs} $userls {
      set usr [string tolower $nk]!$rn@$hs  ;  set isx 0
      foreach xmask $xmptls {
        if {[string match $xmask $usr]} {  set isx 1  ;  break  }
      }
      if {$isx=="0"} {  lappend tmpls $nk $rn $hs  }
    }
    set userls $tmpls  ;  unset tmpls xmptls
    if {[llength $userls]<[expr {$ojClone(punish-at)*3}]} {  return  }
  }

  set chostls [list]
  foreach {nk rn hs} $userls {
    if {[info exists count($hs)]} {  incr count($hs)
      if {$count($hs)==$ojClone(punish-at)} {  lappend chostls *@$hs  }
    } else {  set count($hs) 1  }
  }
  if {[llength $chostls]=="0"} {  return  }

  set clonels [list]
  foreach {nk rn hs} $userls {
    if {$count($hs)>=$ojClone(punish-at)} {  lappend clonels $nk  }
  }
  unset count userls

  if {$ojClone(do-kline)=="1"} {
    lappend map %time $ojClone(kline-time) %reason $ojClone(kl-reason)
    set ojClone(kline-cmd) [string map $map $ojClone(kline-cmd)]
    foreach hs $chostls {
      putquick [string map [list %mask $hs] $ojClone(kline-cmd)]
    }
    if {[string match *%mask* $ojClone(kl-rem-cmd)]} {
      utimer $ojClone(kline-time) [list ojccRemove kln $chostls $ch]
    }
  }
  if {![botisop $ch] && ![botishalfop $ch]} {  return  }
  if {$ojClone(do-ban)=="1"} {  set bhostls [list]
    foreach hs $chostls {  set hs *!$hs
      if {![ischanban $hs $ch]} {
        pushmode $ch +b $hs  ;  lappend bhostls $hs
      }
    }
    if {[llength $bhostls]>"0"} {  flushmode $ch
      if {$ojClone(ban-time)>"0"} {
        utimer $ojClone(ban-time) [list ojccRemove ban $bhostls $ch]
      }
    }
  }
  if {$ojClone(do-kick)=="1"} {  set knickls [list]
    foreach nk $clonels {
      if {[onchan $nk $ch]} {  lappend knickls $nk  }
    }
    if {[llength $knickls]>"0"} {
      if {$ojClone(kick-resn) eq ""} {
        set ojClone(kick-resn) "On-Join Clone Checker by SpiKe^^"
      }
      putkick $ch [join $knickls ,] $ojClone(kick-resn)
    }
  }
  return
}

proc ojccRemove {wat rls ch} {
  if {$wat eq "kln"} {
    foreach hs $rls {
      putserv [string map [list %mask $hs] $::ojClone(kl-rem-cmd)]
    }
    return
  }
  if {![botonchan $ch]} {  return  }
  if {![botisop $ch] && ![botishalfop $ch]} {  return  }
  foreach hs $rls {
    if {![ischanban $hs $ch]} {  pushmode $ch -b $hs  }
  }
  return
}

putlog "On-Join Clone Checker ver. $ojClone(ver) by SpiKe^^ loaded."

tested and got this result while we have irccloud hosts in the exempted hosts it still gets detected:

14:51:09 Joins: Saffren ~sid56901@8bba-4483-4087-bba6-6392.hampstead.irccloud.com
14:51:09 Joins: Emily ~sid61054@8bba-4483-4087-bba6-6392.hampstead.irccloud.com
14:51:09 Joins: Aurilia ~uid22614@8bba-4483-4087-bba6-6392.hampstead.irccloud.com
14:51:09 Joins: Derrick ~sid79293@8bba-4483-4087-bba6-6392.hampstead.irccloud.com
14:51:09 Joins: Strepphon ~uid55938@8bba-4483-4087-bba6-6392.hampstead.irccloud.com
14:51:09 @Hawk Sets Mode on #test to: +b *!*@8bba-4483-4087-bba6-6392.hampstead.irccloud.com
14:51:09 Saffren ~sid56901@8bba-4483-4087-bba6-6392.hampstead.irccloud.com Kicked from #test By @Hawk ( Excess Clones! )
14:51:09 Emily ~sid61054@8bba-4483-4087-bba6-6392.hampstead.irccloud.com Kicked from #test By @Hawk ( Excess Clones! )
14:51:09 Aurilia ~uid22614@8bba-4483-4087-bba6-6392.hampstead.irccloud.com Kicked from #test By @Hawk ( Excess Clones! )
14:51:09 Derrick ~sid79293@8bba-4483-4087-bba6-6392.hampstead.irccloud.com Kicked from #test By @Hawk ( Excess Clones! )
14:51:09 Strepphon ~uid55938@8bba-4483-4087-bba6-6392.hampstead.irccloud.com Kicked from #test By @Hawk ( Excess Clones! )
User avatar
CrazyCat
Revered One
Posts: 1302
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: gline joinflood to snircd

Post by CrazyCat »

Add some putlogs to check what happens.
Here is a small addition of putlog to show you how you can have relevant informations: https://tools.eggdrop.fr/privatebin/?fc ... SqdzBYgFYm
Post Reply