| View previous topic :: View next topic |
| Author |
Message |
Nucleus Voice
Joined: 09 Jul 2004 Posts: 34
|
Posted: Thu Apr 21, 2005 3:01 am Post subject: Clone Protection Script |
|
|
Ok, this is a good clone protection script, i tested it, and as soon as the third clone joins the channel, it puts a ban, and kicks all three of them.
| Code: | # Set the next line as the kick msg you want to say
set clone_msg "Clones"
# Set the next line as the number of clones to scan for
set clone_max 3
# Set the next line as the channels you want to run in
set clone_chans "#MyChan"
proc join_clone {nick uhost hand chan} {
global clone_msg clone_max clone_chans botnick
if {(([lsearch -exact [string tolower $clone_chans] [string tolower $chan]] != -1) || ($clone_chans == "*")) && (![matchattr $hand m|m $chan]) && (![matchattr $hand b]) && ($nick != $botnick)} {
set host [lindex [split $uhost @] 1]
set count 0
foreach i [chanlist $chan] {
if {[lindex [split [getchanhost $i $chan] @] 1] == $host} { incr count }
}
if {$count >= $clone_max} {
newchanban $chan [maskhost [getchanhost $nick $chan]] $botnick $clone_msg 10min
putserv "KICK $chan $nick :$clone_msg"
}
}
}
bind join - * join_clone
putlog "=====>> Clone Protection Loaded" |
The problem is that it puts the ban in the bot's internal banlist instead of a channel ban. Now, have in mind that i dont know tcl scripting, but, my first guess, would be to replace this line:
| Code: | | newchanban $chan [maskhost [getchanhost $nick $chan]] $botnick $clone_msg 10min |
With this?
| Code: | | putquick "MODE $chan +b $clone_msg" |
Thanks for your help |
|
| Back to top |
|
 |
avilon Halfop

Joined: 13 Jul 2004 Posts: 64 Location: Germany
|
Posted: Thu Apr 21, 2005 7:30 am Post subject: |
|
|
| Code: | | putquick "MODE $chan +b [maskhost $nick!$uhost]" |
|
|
| Back to top |
|
 |
Nucleus Voice
Joined: 09 Jul 2004 Posts: 34
|
Posted: Thu Apr 21, 2005 8:15 am Post subject: |
|
|
| Well, it allows me to remove the ban, but now, after placing the ban, it only kicks the last clone to enter the channel. Not all of them. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Apr 21, 2005 8:56 am Post subject: |
|
|
you can add this to filter kick
| Code: | foreach clone [chanlist $chan] {
if {[string match -nocase [maskhost $nick!$uhost] [maskhost [getchanhost $clone $chan]]]} {
puthelp "KICK $chan $clone :$clone_msg"
}
} |
Or, which would be much better and faster, is to add the nicks into an array on join then kick them when max clones is reached. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Nucleus Voice
Joined: 09 Jul 2004 Posts: 34
|
Posted: Thu Apr 21, 2005 10:07 am Post subject: |
|
|
| Sir_Fz wrote: |
Or, which would be much better and faster, is to add the nicks into an array on join then kick them when max clones is reached. |
umm...how do i do that?  |
|
| Back to top |
|
 |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Thu Apr 21, 2005 10:21 am Post subject: |
|
|
Code has been modified, give it a go. By now you should know how to modify the code, for tweaks. I also fixed up your code a bit.
| Code: |
#Set the next line as the kick msg you want to say
set clone_msg "Clones"
#Set the next line as the number of clones to scan for
set clone_max 3
#Set the next line as the channels you want to run in
set clone_chans "#MyChan"
proc join_clone {nick uhost hand chan} {
global clone_msg clone_max clone_chans botnick
if {([lsearch -exact [string tolower $clone_chans] [string tolower $chan]] != -1) || ($clone_chans == "*") && ![matchattr $hand m|m $chan] && ![matchattr $hand b] && ![isbotnick $nick] && [botisop $chan]} {
set host [lindex [split $uhost @] 1]; set count 0
foreach i [chanlist $chan] {
if {[string equal -nocase $host [lindex [split [getchanhost $i $chan] @] 1]]} {
incr count
}
}
if {$count >= $clone_max} {
putquick "MODE $chan +b *!*@$host" -next
foreach clone [chanlist $chan] {
if {[string equal -nocase $host [lindex [split [getchanhost $i $chan] @] 1]]} {
putquick "KICK $chan $clone :$clone_msg" -next
}
}
}
}
}
|
Although we can run only 1 loop, remove the second one, in the first one lappend nicks to a list, if not greater unset list, if greater go ahead and kick everyone in the list no need to scan the chanlist again for users matching the mask. _________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
================================== |
|
| Back to top |
|
 |
Nucleus Voice
Joined: 09 Jul 2004 Posts: 34
|
Posted: Thu Apr 21, 2005 10:39 am Post subject: |
|
|
For some reason, when the third clone joins the channel, the bot bans the clone's host, and then kicks itself from the channel....
[17:36:07] * Joins: clone33 (~geek@host.com)
[17:36:07] * eggdropt sets mode: +b *!*@geek@host.com
[17:36:07] * eggdropt was kicked by eggdropt (Clones)
[17:36:15] * Joins: eggdropt (~GreekGod@egghost.com)
kinda funny though  |
|
| Back to top |
|
 |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Thu Apr 21, 2005 10:52 am Post subject: |
|
|
It should be this:
| Code: |
putquick "MODE $chan +b *!*@[lindex [split $uhost @] 1]" -next
|
| Code: |
foreach clone [chanlist $chan] {
if {[string equal -nocase [lindex [split $uhost @] 1] [lindex [split [getchanhost $i $chan] @] 1]]} {
putquick "KICK $chan $clone :$clone_msg" -next
}
}
|
_________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
================================== |
|
| Back to top |
|
 |
Nucleus Voice
Joined: 09 Jul 2004 Posts: 34
|
Posted: Thu Apr 21, 2005 11:04 am Post subject: |
|
|
This is the script after the modifications. Still reacts the same way though. Puts the ban, then kicks itself.
| Code: | #Set the next line as the kick msg you want to say
set clone_msg "Clones"
#Set the next line as the number of clones to scan for
set clone_max 3
#Set the next line as the channels you want to run in
set clone_chans "#MyChan"
proc join_clone {nick uhost hand chan} {
global clone_msg clone_max clone_chans botnick
if {([lsearch -exact [string tolower $clone_chans] [string tolower $chan]] != -1) || ($clone_chans == "*") && ![matchattr $hand m|m $chan] && ![matchattr $hand b] && ![isbotnick $nick] && [botisop $chan]} {
set host [lindex [split $uhost @] 1]; set count 0
foreach i [chanlist $chan] {
if {[string equal -nocase $host [lindex [split [getchanhost $i $chan] @] 1]]} {
incr count
}
}
if {$count >= $clone_max} {
putquick "MODE $chan +b *!*@[lindex [split $uhost @] 1]" -next
foreach clone [chanlist $chan] {
if {[string equal -nocase [lindex [split $uhost @] 1] [lindex [split [getchanhost $i $chan] @] 1]]} {
putquick "KICK $chan $clone :$clone_msg" -next
}
}
}
}
}
putlog "=====>> Clone Protection Loaded" |
|
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Apr 21, 2005 6:19 pm Post subject: |
|
|
Try this:
| Code: | # Set the next line as the kick msg you want to say
set clone_msg "Clones"
# Set the next line as the number of clones to scan for
set clone_max 3
# Set the next line as the channels you want to run in
set clone_chans "#MyChan"
proc join_clone {nick uhost hand chan} {
global clone_msg clone_max clone_chans botnick
if {(([lsearch -exact [string tolower $clone_chans] [string tolower $chan]] != -1) || ($clone_chans == "*")) && (![matchattr $hand m|m $chan]) && (![matchattr $hand b]) && ($nick != $botnick)} {
set host [lindex [split $uhost @] 1]
set count 0
foreach i [chanlist $chan] {
if {[string equal -nocase [lindex [split [getchanhost $i $chan] @] 1] $host]} {
incr count
lappend cnicks "$i"
}
}
if {$count >= $clone_max} {
putquick "MODE $chan +b *!*@$host"
foreach cnick $cnicks {
putquick "KICK $chan $cnick :$clone_msg"
}
}
}
}
bind join - * join_clone |
This should do the job, but if the bot is a clone then it'll kick itself too  _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Nucleus Voice
Joined: 09 Jul 2004 Posts: 34
|
Posted: Fri Apr 22, 2005 2:01 am Post subject: |
|
|
| Yes! It worked, and it’s very fast too. Thank you. |
|
| Back to top |
|
 |
|