Code: Select all
bind flud - join foo
proc foo {n u args} {
regsub {[^@]+} $u * u
putserv "akill $u :abusive join flood"
}
Code: Select all
/gline !+*@106.109.108.78 3600 :Localclone?
Code: Select all
bind flud - join foo
proc foo {n u args} {
regsub {[^@]+} $u * u
putserv "akill $u :abusive join flood"
}
Code: Select all
/gline !+*@106.109.108.78 3600 :Localclone?
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
}
Let me know how that works out.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.
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
}
Code: Select all
putserv "gline !+*@106.109.108.78 3600 :Localclone?"
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
}
}
}
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."
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 usefullSpiKe^^ 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.
GoodLuck, Let Me Know.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."
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."
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! )