<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/18026" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2010-09-29T19:19:49-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/18026</id>

		<entry>
		<author><name><![CDATA[Luminous]]></name></author>
		<updated>2010-09-29T19:19:49-04:00</updated>

		<published>2010-09-29T19:19:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94578#p94578</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94578#p94578"/>
		<title type="html"><![CDATA[Running tcl commands via pm]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94578#p94578"><![CDATA[
Just wanted to post some updates on this script I have made, in case anyone else wants something similar. I did two things, first is I made it able to output multiple lines and do so optionally, and I made it check to make sure that $nick is on that channel before the command is processed, which makes it more secure. Not sure how to make it more so yet, am open to suggestions. Not many people know of this command, so I'm not too concerned:<br><div class="codebox"><p>Code: </p><pre><code>bind msg n ~tcl tclproc tcl {nick host hand text} { set chan "#chan"   if {$nick eq "$::owner" &amp;&amp; [validchan $chan] &amp;&amp; [onchan $nick $chan]} {    if {[string equal "-newline" [lindex [split $text] 0]]} { set opt 1 set cmd [lrange [split $text] 1 end]    } else { set cmd $text    }    if {[catch [list eval $cmd] result]} {         putmsg $chan "$result "    } {    if {[info exists opt]} {      foreach line $result {          puthelp "PRIVMSG $chan :$line "      }    } else {         putmsg $chan "$result "    }    }   } return}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11101">Luminous</a> — Wed Sep 29, 2010 7:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Luminous]]></name></author>
		<updated>2010-09-25T01:21:17-04:00</updated>

		<published>2010-09-25T01:21:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94508#p94508</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94508#p94508"/>
		<title type="html"><![CDATA[Running tcl commands via pm]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94508#p94508"><![CDATA[
Hm.. does seem to send a request to me, but still nothing overall. I am positive the problem is my irc client, irssi. :S Thanks for the help though. I'll have to research dcc ports in irssi more.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11101">Luminous</a> — Sat Sep 25, 2010 1:21 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2010-09-23T15:53:19-04:00</updated>

		<published>2010-09-23T15:53:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94494#p94494</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94494#p94494"/>
		<title type="html"><![CDATA[Running tcl commands via pm]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94494#p94494"><![CDATA[
First off... PM's are not restricted to a channel... you do not need to be in the same channel as the bot to send a PM.<br><br>On the topic of dcc/telnet; I roughly recalled in an earlier post that you ran your bot behind a NAT (masquerading) firewall along with your irc client? Hence the lan-ip. Nevertheless, if you have an IP address and port number you can telnet to, then this script should do the trick:<div class="codebox"><p>Code: </p><pre><code>bind msg - chat send_chatproc ip2long {address} {  set j 0  foreach i [split $address .] {    if {![string is integer $i]} {      break    }    set j [expr ($j*256+$i)]  }  return [format "%u" $j]}proc send_chat {nick host handle text} {  puthelp "PRIVMSG $nick :\001DCC CHAT chat [ip2long "192.168.1.1"] 1234\001"}</code></pre></div>Just remember to replace 192.168.1.1 and 1234 with the appropriate values.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Sep 23, 2010 3:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Luminous]]></name></author>
		<updated>2010-09-23T09:36:47-04:00</updated>

		<published>2010-09-23T09:36:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94488#p94488</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94488#p94488"/>
		<title type="html"><![CDATA[Running tcl commands via pm]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94488#p94488"><![CDATA[
Ah, I see... yeah, that could be a problem but given the channel this bot is running in, shouldn't be a problem. Its invite-only and basically a smaller channel of friends and our bots, haha. Must be a simple way around that though.<br><br>I would love to stick with dcc, but it doesn't work. I run two bots from the same host, connect to them from the same(but different) host and one day after my screen session died, one of them no longer responded. This happened to many others too and no one's been able to figure it out yet. And I despise the telnet interface heartily. I can't even scroll so any command like .chaninfo that outputs a lot isn't doing me much good via telnet. Plus, I make a lot of typos and rather enjoy being able to not have to retype /everything/ all the time, lol.<br><br>So, about that dcc script.... <blockquote class="uncited"><div>Personally, I'd recommend that you live with the telnet/dcc interface (It's not that hard to write a script that causes your eggdrop to send a dcc-chat request that connects you to the lan-IP rather than the public one).</div></blockquote>What you mean "lan-IP rather than the public one"? Afaik, I can only use one IP and one port.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11101">Luminous</a> — Thu Sep 23, 2010 9:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2010-09-23T02:30:16-04:00</updated>

		<published>2010-09-23T02:30:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94482#p94482</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94482#p94482"/>
		<title type="html"><![CDATA[Running tcl commands via pm]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94482#p94482"><![CDATA[
Indeed, as speechles suspected, those where my concerns...<br>That said, first of all, you evaluate the given code twice. That's usualy not such a good idea. If I were to correct that part of the code, it'd look something like this:<div class="codebox"><p>Code: </p><pre><code>proc msg:tcl {nick host handle text} {  if {[catch [list eval $text] result]} {    putnotc $nick "error: $result"  } {    putmsg $nick "success: $result"  }}</code></pre></div>Keep in mind, that this fix does not add any security whatsoever.<br><br>Personally, I'd recommend that you live with the telnet/dcc interface (It's not that hard to write a script that causes your eggdrop to send a dcc-chat request that connects you to the lan-IP rather than the public one).<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Sep 23, 2010 2:30 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2010-09-22T22:07:40-04:00</updated>

		<published>2010-09-22T22:07:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94481#p94481</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94481#p94481"/>
		<title type="html"><![CDATA[Running tcl commands via pm]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94481#p94481"><![CDATA[
<blockquote class="uncited"><div>I can see an issue if someone were to try to run "zebra cakes" or something as a command, but I plan to run it through a catch for errors. Also ,i will likely be the only one using it... or am I overlooking something else there?<br><br>Edit: So, something like this? It fails though, no errors:<div class="codebox"><p>Code: </p><pre><code>bind msg n ~tcl tclproc tcl {nick host hand text} {    if {[catch {eval $text} err]} { putnotc $nick $err    } else { set cmd [eval $text]    puthelp "PRIVMSG $nick :$cmd"    }}</code></pre></div>If I can just get a single hiccup from it, I can make it nicer, like manage multiple lines of output, etc.</div></blockquote>Nefarious guy in pm to your bot:<blockquote class="uncited"><div>~tcl return "[adduser theirnick theirnick!*@*][chattr theirnick +fghjlmnoptx]"</div></blockquote>They simply wait for the return of "1 fghjlmnoptx" and they've taken over your bot. I think this is more along the lines of what nml375 meant, not errors.<br><br>Note: Your host can be spoofed. That "n" is working off your host record, it's weak part.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Wed Sep 22, 2010 10:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Luminous]]></name></author>
		<updated>2010-09-22T21:47:05-04:00</updated>

		<published>2010-09-22T21:47:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94480#p94480</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94480#p94480"/>
		<title type="html"><![CDATA[Running tcl commands via pm]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94480#p94480"><![CDATA[
I can see an issue if someone were to try to run "zebra cakes" or something as a command, but I plan to run it through a catch for errors. Also ,i will likely be the only one using it... or am I overlooking something else there?<br><br>Edit: So, something like this? It fails though, no errors:<div class="codebox"><p>Code: </p><pre><code>bind msg n ~tcl tclproc tcl {nick host hand text} {    if {[catch {eval $text} err]} { putnotc $nick $err    } else { set cmd [eval $text]    puthelp "PRIVMSG $nick :$cmd"    }}</code></pre></div>If I can just get a single hiccup from it, I can make it nicer, like manage multiple lines of output, etc.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11101">Luminous</a> — Wed Sep 22, 2010 9:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2010-09-22T18:05:43-04:00</updated>

		<published>2010-09-22T18:05:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94478#p94478</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94478#p94478"/>
		<title type="html"><![CDATA[Running tcl commands via pm]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94478#p94478"><![CDATA[
You can use the <strong class="text-strong">eval</strong> command to evaluate any string as a tcl-script. That said, I would recommend against letting any untrusted data be parsed as a script, you need to put some serious thoughts into your security-model if you intend to pursuit this path..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Sep 22, 2010 6:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Luminous]]></name></author>
		<updated>2010-09-22T16:23:19-04:00</updated>

		<published>2010-09-22T16:23:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94475#p94475</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94475#p94475"/>
		<title type="html"><![CDATA[Running tcl commands via pm]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94475#p94475"><![CDATA[
My bot no longer dcc chats with me, so I am looking to convert all the dcc commands to privmsg. The two biggest ones are .tcl  and .set, but this post is about .tcl in particular. Is it possible to run .tcl via pm? I was thinking it could be done with tclsh but I am not sure since it prompts for each command. Trying to take $text as a command only resulted in "no such command" errors and I don't think "exec"  will work either. A pointer in the right direction would be great, if this is possible. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11101">Luminous</a> — Wed Sep 22, 2010 4:23 pm</p><hr />
]]></content>
	</entry>
	</feed>
