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.

Clone Protection Script

Support & discussion of released scripts, and announcements of new releases.
Post Reply
N
Nucleus
Voice
Posts: 34
Joined: Fri Jul 09, 2004 3:35 am

Clone Protection Script

Post by Nucleus »

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: Select all

# 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: Select all

newchanban $chan [maskhost [getchanhost $nick $chan]] $botnick $clone_msg 10min
With this?

Code: Select all

putquick "MODE $chan +b $clone_msg"
Thanks for your help
User avatar
avilon
Halfop
Posts: 64
Joined: Tue Jul 13, 2004 6:58 am
Location: Germany

Post by avilon »

Code: Select all

putquick "MODE $chan +b [maskhost $nick!$uhost]"
N
Nucleus
Voice
Posts: 34
Joined: Fri Jul 09, 2004 3:35 am

Post by Nucleus »

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.
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

you can add this to filter kick

Code: Select all

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.
N
Nucleus
Voice
Posts: 34
Joined: Fri Jul 09, 2004 3:35 am

Post by Nucleus »

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? :roll:
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

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: Select all

#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.
==================================
N
Nucleus
Voice
Posts: 34
Joined: Fri Jul 09, 2004 3:35 am

Post by Nucleus »

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 :P
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

It should be this:

Code: Select all

 putquick "MODE $chan +b *!*@[lindex [split $uhost @] 1]" -next 

Code: Select all

 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.
==================================
N
Nucleus
Voice
Posts: 34
Joined: Fri Jul 09, 2004 3:35 am

Post by Nucleus »

This is the script after the modifications. Still reacts the same way though. Puts the ban, then kicks itself.

Code: Select all

#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"
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Try this:

Code: Select all

# 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 :P
N
Nucleus
Voice
Posts: 34
Joined: Fri Jul 09, 2004 3:35 am

Post by Nucleus »

Yes! It worked, and it’s very fast too. Thank you.
Post Reply