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 

Auto-Add on Channel Registration

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
JC^
Voice


Joined: 25 May 2007
Posts: 4

PostPosted: Tue May 29, 2007 12:26 pm    Post subject: Auto-Add on Channel Registration Reply with quote

Hi. I'd like to make a script where the eggdrop can join and add itself to a channel as soon as its created.

I've got a channel where every command is outputted and so when a channel is created and registered, the channel says:

Code:
<Global> ChanServ: Channel '#Cottage-by-the-Sea' registered by Dorian


I'd like the bot to be able to listen for that or a similar string, then automatically perform a +chan automatically so it joins the channel, then saves it all the next time it does the chansave.

Can someone assist me?
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Sun Jan 27, 2008 2:46 pm    Post subject: Reply with quote

Code:

proc pub:global:chanreg {nick host handle channel text} {
global botnick
 set type [lindex $text 0]
  if {$type == "Channel"} {
   set newchan [lindex [split [lindex $text 1] "'"] 1]
    if {![validchan $newchan]} {
     channel add $newchan
      puthelp "PRIVMSG ChanServ :SOP $newchan ADD $botnick"
       return 1
    }
  }
}

bind pub -|- "ChanServ:" pub:global:chanreg
let me know if there are any problems, errors or things ya want changing. Smile
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Mon Jan 28, 2008 1:25 pm    Post subject: Reply with quote

That script will cause problems if you use it like that.
This version should be much more secure.

Also, you should note that the bot will use alot of resources if it has to join alot of channels like this.
You're better off using a network service for these kind of things.

[untested]

Code:
# Make sure you set the full hostname here. (this is to make sure it's not spoofed)
set chanserv(source) "Global!user@hostname"
# This is the message that's sent by the service (don't change it)
set chanserv(pattern) "ChanServ: Channel '*' registered by *"
# The channel in which the service sends the message.
set chanserv(channel) "#servicechannel"

bind pub -|- "ChanServ:" pub:global:chanreg

proc pub:global:chanreg {nick host handle channel text} {
    global chanserv
    if {[string equal -nocase $channel $chanserv(channel)] && [string equal -nocase $nick!$host $chanserv(source)] && [string match -nocase $chanserv(pattern) $text]} {
        set text [string map [list ' ""] $text]
        set channel [lindex [split $text] 2]

        if {![validchan $channel]} {
            channel add $channel
        }
    }
}
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Mon Jan 28, 2008 7:50 pm    Post subject: Reply with quote

It would be difficult to make this type of script secure. I'm sure the person that owns the bot/network would of increased security my means such as locking the channel ...etc as this tends to be strongly adviced when having services log to a channel. On a scripting note, Is it even possible to check the hostmask of Global in this situation, since it wouldn't be on the channel (unless you use a module to do this*). I assumed this type of thing would be the same as a server sending msg's to a channel. Smile
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Tue Jan 29, 2008 1:48 pm    Post subject: Reply with quote

TCL_no_TK wrote:
It would be difficult to make this type of script secure. I'm sure the person that owns the bot/network would of increased security my means such as locking the channel ...etc as this tends to be strongly adviced when having services log to a channel. On a scripting note, Is it even possible to check the hostmask of Global in this situation, since it wouldn't be on the channel (unless you use a module to do this*). I assumed this type of thing would be the same as a server sending msg's to a channel. Smile


Actually, regardless of if the sender is on the channel or not, the nickname and user@hostname are still sent with the PRIVMSG.

Also _YOUR_ script was so insecure it would allow any user to add channels regardless of who said the line.
Since the eggdrop would be on alot of channels it would allow any user to spam the bot by adding it to dozens if not hundreds of channels.

Not to sound smug or arrogant but if you don't know about the IRC protocol then please don't tell me that my script is pointless.
My script is pretty much as secure as it can get whilst yours is an open book to any user.
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Tue Jan 29, 2008 3:55 pm    Post subject: Reply with quote

Quote:
... regardless of if the sender is on the channel or not, the nickname and user@hostname are still sent with the PRIVMSG.
Thanks, good to know. Was thinking of server's Smile
Quote:
Also _YOUR_ script was so insecure it would allow any user to add channels regardless of who said the line.
Since the eggdrop would be on alot of channels it would allow any user to spam the bot by adding it to dozens if not hundreds of channels.
I was aware of this but as i stated, it would be difficult to make this type of script secure. As you said i think it would be better to use network services such as BotServ for this type of thing.
Quote:
Not to sound smug or arrogant but if you don't know about the IRC protocol then please don't tell me that my script is pointless.
My script is pretty much as secure as it can get whilst yours is an open book to any user.
These comments would be better off left for private message, since i cant see them being constructive/relivant to this topic. Rolling Eyes I like giving my input and asking questions about scripting on differant posts as long as i dosen't disrupt it. I dont think it would appropriate to pick out "security holes" in each others code like this. Sad
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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