egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Clone Protection Script

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
Nucleus
Voice


Joined: 09 Jul 2004
Posts: 34

PostPosted: Thu Apr 21, 2005 3:01 am    Post subject: Clone Protection Script Reply with quote

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
View user's profile Send private message
avilon
Halfop


Joined: 13 Jul 2004
Posts: 64
Location: Germany

PostPosted: Thu Apr 21, 2005 7:30 am    Post subject: Reply with quote

Code:
putquick "MODE $chan +b [maskhost $nick!$uhost]"
Back to top
View user's profile Send private message
Nucleus
Voice


Joined: 09 Jul 2004
Posts: 34

PostPosted: Thu Apr 21, 2005 8:15 am    Post subject: Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Apr 21, 2005 8:56 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Nucleus
Voice


Joined: 09 Jul 2004
Posts: 34

PostPosted: Thu Apr 21, 2005 10:07 am    Post subject: Reply with quote

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? Rolling Eyes
Back to top
View user's profile Send private message
awyeah
Revered One


Joined: 26 Apr 2004
Posts: 1580
Location: Switzerland

PostPosted: Thu Apr 21, 2005 10:21 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Nucleus
Voice


Joined: 09 Jul 2004
Posts: 34

PostPosted: Thu Apr 21, 2005 10:39 am    Post subject: Reply with quote

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 Razz
Back to top
View user's profile Send private message
awyeah
Revered One


Joined: 26 Apr 2004
Posts: 1580
Location: Switzerland

PostPosted: Thu Apr 21, 2005 10:52 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Nucleus
Voice


Joined: 09 Jul 2004
Posts: 34

PostPosted: Thu Apr 21, 2005 11:04 am    Post subject: Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Apr 21, 2005 6:19 pm    Post subject: Reply with quote

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 Razz
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Nucleus
Voice


Joined: 09 Jul 2004
Posts: 34

PostPosted: Fri Apr 22, 2005 2:01 am    Post subject: Reply with quote

Yes! It worked, and it’s very fast too. Thank you.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber