| View previous topic :: View next topic |
| Author |
Message |
exelent Voice
Joined: 15 Jul 2007 Posts: 1
|
Posted: Sun Jul 15, 2007 12:41 pm Post subject: BotProtect |
|
|
Hi. One friend of mine wrote me a TCL called TCM.tcl. I don't know from where the name comes. This TCL protects the bot from been kicked and banned from the channel. The TCL sets global ban to the user and kick him from the channel. Can you see if I have made any mistakes? I want the bot to sets ban like this *!*ident@host.com. Here is the script:
| Code: |
# created by Yxaaaaaaa ( http://www.egghelp-bg.com
#
## Kakuv da e reasona, kogato bota nakazva narushitelq, koito go e bannal
set ebreason "Ban me?That option is forbidden for you!"
## Kakuv da e reasona, kogato bota nakazva narushitelq, koito go e kiknal
set ekreason "Kick me?That option is forbidden for you!"
## Potrebiteli s kakuv flag da ne bydat nakazvani
set ekbflag "W"
bind mode - *-o* e:dprot
proc e:dprot {n u h c m t} {
regsub {~} $u "" u
set banmask "*!*$u"
if {[matchattr $h $::ekbflag]} return
if {[string match "$t" "$::botname"]} {
putquick "PRIVMSG CS :akick $c add $n $::ebreason"
newchanban $c $banmask Prot "nedei me deopva" 10
putquick "KICK $c $n :nedei me deopva"
}
}
bind mode - *+b* e:bprot
proc e:bprot {n u h c m w} {
regsub {~} $u "" u
set banmask "*!*$u"
if {[matchattr $h $::ekbflag]} return
if {[string match "$w" "$::botname"]} {
putquick "PRIVMSG CS :akick $c add $n $::ebreason"
putquick "PRIVMSG CS :unban $c"
newchanban $c $banmask Prot "nedei me banva" 30
putquick "KICK $c $n :nedei me banva"
}
}
bind kick - * e:kprot
proc e:kprot {n u h c w r} {
regsub {~} $u "" u
set banmask "*!*$u"
if {[matchattr $h $::ekbflag]} return
if {$w == $::botnick} {
putquick "PRIVMSG CS :akick $c add $n $::ekreason"
newchanban $c $banmask Prot "nedei me kickva" 20
putquick "KICK $c $n :nedei me kickva"
}
}
putlog "TCL | TCM"
|
I'm from Bulgaria and I'm still learning English, so I'm sorry if I made some mistakes when I write. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Mon Jul 16, 2007 3:51 am Post subject: |
|
|
One basic idea is to +e the bot's host. I developed a script for that. Whenever my bot gets ops, it checks in the channel +e (exempt list) for it's host, if the host is not in the list, the bot will add it in.
I made this for bot check on channel join, similarly you can edit my code and make it for checking it on regular intervals of time and you can even check it when bot receives op status. If the bot's host is in the +e list, then even if you kick/ban it, it will rejoin immediately, so there would be no need to make a useless script to unban it with timers and flood services as well, if someone is attacking the channel with stolen access and kicking/banning ops.
I haven't released this code publically as a script, but I will later. Anyway these raws are for DALnet, not sure if they work on any other networks.
| Code: |
#################
#Minutes to check channel exempt list after bot joins
set exemptdelaycheck "2"
bind raw - 348 exempt:add
bind raw - 349 exempt:end
bind join - "*" exempt:on:op:delay
proc exempt:on:op:delay {nick uhost hand chan} {
global exemptdelaycheck
if {[isbotnick $nick]} {
timer $exemptdelaycheck [list exempt:on:op $nick $uhost $hand $chan]
}
}
proc exempt:on:op {nick uhost hand chan} {
if {[botisop $chan]} {
putquick "MODE $chan +e" -next
}
}
proc exempt:add {from keyword arg} {
global exempthost
set arg [split $arg]
set chan [string tolower [lindex $arg 0]]
if {![info exists exempthost($chan)]} { set exempthost($chan) [list] }
lappend exempthost($chan) [string tolower [lindex $arg 2]]
return 1
}
proc exempt:end {from keyword arg} {
global botnick botname exempthost
set arg [split $arg]
set chan [string tolower [lindex $arg 1]]
if {[info exists exempthost($chan)] && ([llength $exempthost($chan)] >= 1)} {
foreach host $exempthost($chan) {
if {[string match -nocase "*$host*" $botname]} {
if {[info exists exempthost($chan)]} { unset exempthost($chan) }
set found 1; break
}
}
}
if {![info exists found]} {
putquick "MODE $chan +e $botname" -next
}
if {[info exists exempthost($chan)]} { unset exempthost($chan) }
}
|
Edited: Split $arg and removed unwanted info exists _________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Last edited by awyeah on Mon Jul 30, 2007 3:01 am; edited 2 times in total |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Sat Jul 28, 2007 9:00 pm Post subject: |
|
|
Those RAWs are not Bahamut specific.
| Quote: | 348 RPL_EXCEPTLIST RFC2812 <channel> <exceptionmask> An exception mask for the exception mask list. Also known as RPL_EXLIST (Unreal, Ultimate)
349 RPL_ENDOFEXCEPTLIST RFC2812 <channel> :<info> Termination of an RPL_EXCEPTLIST list. Also known as RPL_ENDOFEXLIST (Unreal, Ultimate) |
_________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Sun Jul 29, 2007 4:57 am Post subject: |
|
|
Well they work fine with bahamut, i.e. with my eggdrop on DALnet. _________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
================================== |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Sun Jul 29, 2007 9:54 am Post subject: |
|
|
| awyeah wrote: | | Well they work fine with bahamut, i.e. with my eggdrop on DALnet. |
I know they do.
It's probably good that other (non Bahamut) users know that your script will work for them also.  _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Jul 29, 2007 11:32 am Post subject: |
|
|
Assuming your bot's hostmask does'nt change every now and then, would'nt it be simpler to simply:
| Code: | .+exempt *!user@host #channel %0
.stick exempt *!user@host #channel |
Saves you any trouble that might occur with improperly setting dynamicexempts and userexempts.
Could also be scripted to update the internal exempts-list as your eggie connects, in case of changing hostmasks... API is pretty much identical to the banlist API.
@Awyeah:
Remember to split strings before using lindex...
Also, this line puzzles me:
| Code: | | if {[info exists found]} { unset found } |
"found" isn't set previously in the proc, and is not a globalspace variable...
I also don't see why you repeat that check in the end of that same proc, as there is no code depending on found after that (and variable would be removed as the temporary namespace is destroyed when the proc exits).
Other than that, it's a good script for those running older eggies lacking support for exempt-modes. Might be a good idea to add I-mode aswell. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Mon Jul 30, 2007 3:00 am Post subject: |
|
|
Sorry, my bad. I think when I quickly pasted the script in a hurry, I overlooked those small bugs, which I made during coding it.
Anyway, I edited the code above now split the args properly and removed the unwanted info exists for local var found.
Yeah you are right, an exact script can be made for +I, you just have to change the raw numerics I guess and +e to +I im my oppinion. _________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
================================== |
|
| Back to top |
|
 |
|