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.

BotProtect

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
e
exelent
Voice
Posts: 1
Joined: Sun Jul 15, 2007 11:51 am

BotProtect

Post by exelent »

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

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

Post by Sir_Fz »

Try it and see if it has any mistakes.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

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

#################

#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
Last edited by awyeah on Mon Jul 30, 2007 3:01 am, edited 2 times in total.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Those RAWs are not Bahamut specific.
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
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

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.
==================================
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

awyeah wrote:Well they work fine with bahamut, i.e. with my eggdrop on DALnet.
I know they do. :lol:

It's probably good that other (non Bahamut) users know that your script will work for them also. :wink:
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Assuming your bot's hostmask does'nt change every now and then, would'nt it be simpler to simply:

Code: Select all

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

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

Post by awyeah »

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.
==================================
Post Reply