I have a clone detection script. It detects mass clones/botnets joining a channel very fast, which bans and kicks them. It also detects clones and botnets doing channel cycles very fast and bans and kicks them out.
Currently I am using newchanban. The newchanban stacks the kicks properly, so if there are alot of clones the bot doesn't get excess flood while kicking the clones out. (if there are alot even!)
The thing is that channels I use, some people on them logon from cybercafes, universities, which have LAN and static IPs. Some of them are OPS as well which causes a greater problem. I can't use newchanban as it bans the ops even. Plus I cant add every op in the +o, or any user flag and make them exempt it like +dontkickops or even add it in the tcl to exempt them, as there are many, infact alot of ops!
So here I have a small solution to detect and kick the clones.
If someone can help me to optimize this in a better way it would be great.
Normally the bot gets excess flood after kicking 7-8 ops with this script, and with newchanban it can kick upto 15+ or more!
Code: Select all
proc clone:kick:remove {banmask nick host chan} {
global botnick clonebantime
set users [chanlist $chan]; set kicklist [list]
foreach user $users {
if {[string equal -nocase $user $nick]} { continue }
if {([string match -nocase *$host* "${nick}![getchanhost $user $chan]"]) && (![isop $chan $user])} { lappend kicklist $user }
}
putquick "KICK $chan [join $kicklist {,}] :<my kick msg>"
timer $clonebantime [list clone:unban $banmask $chan]
}
If I add a foreach loop, 'foreach person $kicklist' instead of
joining $kicklist with {,} then would it be faster?
I am using putquick with -next because it is currently the most
fastest way todo things as I want to kick the clones out of the channel
as fast as possible, so they dont flood. The others putserv, putkick are relatively slower.
If someone or anyone here has a better idea to do this in a faster,
efficient way, so the bot does not get excess flood, if it kicks many
users please let me know, how to implement this!
I have set my max-queue and etc other send/queue sizes in the .conf file to a larger number as well, so that did not resolve it as well.