| View previous topic :: View next topic |
| Author |
Message |
JC^ Voice
Joined: 25 May 2007 Posts: 4
|
Posted: Tue May 29, 2007 12:26 pm Post subject: Auto-Add on Channel Registration |
|
|
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 |
|
 |
TCL_no_TK Owner

Joined: 25 Aug 2006 Posts: 509 Location: England, Yorkshire
|
Posted: Sun Jan 27, 2008 2:46 pm Post subject: |
|
|
| 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.  _________________ TCL the misunderstood |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Mon Jan 28, 2008 1:25 pm Post subject: |
|
|
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 |
|
 |
TCL_no_TK Owner

Joined: 25 Aug 2006 Posts: 509 Location: England, Yorkshire
|
Posted: Mon Jan 28, 2008 7:50 pm Post subject: |
|
|
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.  _________________ TCL the misunderstood |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Tue Jan 29, 2008 1:48 pm Post subject: |
|
|
| 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.  |
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 |
|
 |
TCL_no_TK Owner

Joined: 25 Aug 2006 Posts: 509 Location: England, Yorkshire
|
Posted: Tue Jan 29, 2008 3:55 pm Post subject: |
|
|
| 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 | 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. 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.  _________________ TCL the misunderstood |
|
| Back to top |
|
 |
|