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 

Optools

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
krieg
Voice


Joined: 20 Nov 2007
Posts: 13

PostPosted: Sat Dec 15, 2007 12:49 pm    Post subject: Optools Reply with quote

I have optools.tcl the codes like this

Code:
# op tools por Marco Ferra aka nXistence
# http://clientes.netvisao.pt/mferra/
# marcoferra@netvisao.pt
# versao 1.1

# !c, !op <nick>, !vo <nick>, !k <nick> razao
# !b <host> razao, !ub <host>, !kb <nick> razao
# !t <topico>, !p, !jump servidor porta, !die razao
# !status, !broadcast <mensagem>

bind pub o !h pub:h
bind pub o !c pub:c
bind pub o !op pub:op
bind pub o !vo pub:vo
bind pub o !k pub:kick
bind pub o !b pub:ban
bind pub o !ub pub:ub
bind pub o !kb pub:kb
bind pub o !t pub:topic
bind pub - !p pub:p
bind pub n !jump pub:jump
bind pub n !die pub:die
bind pub o !status pub:status
bind pub o !broadcast pub:broadcast

proc pub:h {nick uhost hand chan text} {
  puthelp "NOTICE $nick :!c !op !vo !k !b !ub !kb !t !p !jump !die !status !broadcast"
}

proc pub:c {nick uhost hand chan text} {
  if {[botisop $chan] == 1} {
    if {[isop $nick $chan] == 1} { pushmode $chan -o $nick } else { pushmode $chan +o $nick }
  } else { puthelp "NOTICE $nick :i dont have ops!" }
}

proc pub:op {nick uhost hand chan text} {
  if {[botisop $chan] == 1} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[onchan $tnick $chan]} {
        if {[isop $tnick $chan]} { pushmode $chan -o $tnick } else { pushmode $chan +o $tnick }
      } else { puthelp "NOTICE $nick :no such nick on channel!" }
    } else { puthelp "NOTICE $nick :usage !op <nick> - inverts the ops of a nick" }
  } else { puthelp "NOTICE $nick :i dont have ops!" }
}

proc pub:vo {nick uhost hand chan text} {
  if {[botisop $chan] == 1} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[onchan $tnick $chan]} {
        if {[isvoice $tnick $chan]} { pushmode $chan -v $tnick } else { pushmode $chan +v $tnick }
      } else { puthelp "NOTICE $nick :no such nick on channel!" }
    } else { puthelp "NOTICE $nick :usage !op <nick> - inverts the voices of a nick" }
  } else { puthelp "NOTICE $nick :i dont have ops!" }
}

proc pub:kick {nick uhost hand chan text} {
  if {[botisop $chan]} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[string length [lindex $text 1]] == 0} { set reason kicked } else { set reason [lrange $text 1 end] }
      if {[onchan $tnick $chan]} { putkick $chan $tnick $reason } else { puthelp "NOTICE $nick :no such nick on channel!" }
    } else { puthelp "NOTICE $nick :usage !k <nick> reason - kicks a nick" }
  } else { puthelp "NOTICE $nick :i dont have ops!" }
}

proc pub:ban {nick uhost hand chan text} {
  if {[botisop $chan]} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[onchan $tnick $chan]} {
        if {[string length [lindex $text 1]] == 0} { set reason banned } else { set reason [lrange $text 1 end] }
        newchanban $chan *!*@[lindex [split [getchanhost $tnick $chan] @] 1] $nick $reason 10
      } else { puthelp "notice $nick :no such nick on channel!" }
    } else { puthelp "NOTICE $nick :usage !b <nick> reason - bans a nick" }
  } else { puthelp "NOTICE $nick :i dont have ops!" }
}

proc pub:ub {nick uhost hand chan text} {
  if {[botisop $chan]} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[ischanban $tnick $chan]} { killchanban $chan $tnick } else { puthelp "NOTICE $nick :no such ban on $chan" }
    } else { puthelp "NOTICE $nick :usage !ub <nick!user@host> - unbans an address" }
  } else { puthelp "NOTICE $nick :i dont have ops!" }
}

proc pub:kb {nick uhost hand chan text} {
  if {[botisop $chan]} {
    if {[string length $text] > 0} {
      set tnick [lindex $text 0]
      if {[onchan $tnick $chan]} {
        if {[string length [lindex $text 1]] == 0} { set reason banned } else { set reason [lrange $text 1 end] }
        newchanban $chan *!*@[lindex [split [getchanhost $tnick $chan] @] 1] $nick $reason 10
        utimer 5 [putkick $chan $tnick $reason]
      } else { puthelp "notice $nick :no such nick on channel!" }
    } else { puthelp "NOTICE $nick :usage !kb <nick> reason - kicks and bans a nick" }
  } else { puthelp "NOTICE $nick :i dont have ops!" }
}

proc pub:topic {nick uhost hand chan text} {
  if {[botisop $chan]} { putserv "TOPIC $chan :$text" } else { puthelp "NOTICE $nick :i dont have ops!" }
}

proc pub:p {nick uhost hand chan text} { putserv "PRIVMSG $chan :connected!" }

proc pub:jump {nick uhost hand chan text} { jump $text }

proc pub:die {nick uhost hand chan text} { die $text }

proc pub:status {nick uhost hand chan text} {
  global server botname version
  puthelp "NOTICE $nick :user records: [countusers], channels: [channels], date: [date], time: [time], os: [unames], server: $server, host: $botname, egg version: [lindex $version 0]"
}

proc pub:broadcast {nick uhost hand chan text} {
  if {[string length $text] > 0} {
    set text [string trim $text "{}"]
    foreach n [channels] { puthelp "PRIVMSG $n :$text" }
  } else { puthelp "NOTICE $nick :!broadcast <message> - sends message to all channels that the bot is" }
}

putlog "tcl: optools loaded"


I want to add some codes and features. For example when I write on channel !nb the bot should ban to nickname but do not kick. Only ban.

I want the bot don't kick banned users. For example only I want ban a person I can do it but immediately the bot kick the banned user. Bot should kick only while using !kb command. Because I ban a user with "!b nick" command bot is kicking the victim.
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sat Dec 15, 2007 12:59 pm    Post subject: Reply with quote

try .chanset #yourchan -enforcebans whilst on partyline with your bot during dcc-chat... Surprised

btw, that optools script is a security risk (read this as it should not be used by your bot, ever). It contains no checks what so ever against its internal user records. Your kinda foolish in using it, hope you care very little about the channels your using it in, seriously.

Also, forgot to mention. It uses clumsy methods to accomplish things. Such as treating lists as strings then uses string trim to remove the list element boundaries, the {}'s.. haw.. I would suggest you find another script to use as this is yet antoher exploitable flaw. ;D
Your IRC Channel with this script wrote:
<user> !op user
*** @Bot sets mode: +o user
<@user> !die be gone now
*** @Bot quits (be gone now)
Back to top
View user's profile Send private message
krieg
Voice


Joined: 20 Nov 2007
Posts: 13

PostPosted: Sat Dec 15, 2007 1:22 pm    Post subject: Reply with quote

Quote:
<user> !op user
*** @Bot sets mode: +o user
<@user> !die be gone now
*** @Bot quits (be gone now)

If you write flag like this o|o there is no problem. This is not problem for bot.
.chanset #yourchan -enforcebans is not working.
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sat Dec 15, 2007 1:25 pm    Post subject: Reply with quote

krieg wrote:
Quote:
<user> !op user
*** @Bot sets mode: +o user
<@user> !die be gone now
*** @Bot quits (be gone now)

If you write flag like this o|o there is no problem. This is not problem for bot.

Yes, there is still a problem, the script allows anyone to get opped without checking who is getting opped. Sure, it can check who asks to op somebody with the flags like you say. Okay, but then....what checks who your opping? Understand now? (once rogue is opped, !die the bot, decimate channel). Not to mention, like I said, its using flawed logic treating lists as strings, then using clumsy work arounds that are exploitable to fix the problems you encounter when treating lists as strings. Is why I suggested no one ever use it and forget it exists.

krieg wrote:
.chanset #yourchan -enforcebans is not working.

It gets overly annoying having people just use the phrase 'is not working'. So you want to me to guess now? Without even having standard clues such as what the reply was when you tried this command or a .set errorInfo.. Okay, here goes.. um... More than likely you need to open your eggdrop.conf and rebind the chanset command by #commenting out the unbind. If you want better help, give better clues. Wink

Edit: also, didn't notice this before...
Code:
proc pub:topic {nick uhost hand chan text} {
  if {[botisop $chan]} { putserv "TOPIC $chan :$text" } else { puthelp "NOTICE $nick :i dont have ops!" }
}
Can you tell why this proc is redundant and unneccessary? Try setting your irc channel -t and the ircd can let anyone in the channel change topic... There are many many reasons not to use this script, just pointing a few out.

Last edited by speechles on Sat Dec 15, 2007 1:43 pm; edited 2 times in total
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Dec 15, 2007 1:41 pm    Post subject: Reply with quote

Actually, there is even worse issues with this script. Anyone matching an userrecord with o-flag could easily elevate their privileges to owner-status. This is due to insecure use of timers.
Try something like this, and you'll find some interresting behaviours:
Quote:
!kb {botnick} {[die "Hacked by eviluser"]}
!kb {botnick} {[chattr yourhandle +n]Kicking myself}
!kb {botnick} {[exec "some_shellbackdoor"]}

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
krieg
Voice


Joined: 20 Nov 2007
Posts: 13

PostPosted: Sat Dec 15, 2007 1:52 pm    Post subject: Reply with quote

Is there any reliable op commands tcl?
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Dec 15, 2007 1:53 pm    Post subject: Reply with quote

Using /msg yourbot OP and the dcc-chat .op?
_________________
NML_375, idling at #eggdrop@IrcNET
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 -> Scripting Help 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