<?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/16838" />

	<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>2009-04-29T08:47:59-04:00</updated>

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

		<entry>
		<author><name><![CDATA[DaRkOoO]]></name></author>
		<updated>2009-04-29T08:47:59-04:00</updated>

		<published>2009-04-29T08:47:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88609#p88609</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88609#p88609"/>
		<title type="html"><![CDATA[Execute shell commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88609#p88609"><![CDATA[
This one works,thank you..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10236">DaRkOoO</a> — Wed Apr 29, 2009 8:47 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-04-29T08:37:51-04:00</updated>

		<published>2009-04-29T08:37:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88608#p88608</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88608#p88608"/>
		<title type="html"><![CDATA[Execute shell commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88608#p88608"><![CDATA[
Actually, there is no double substitution issues with exec, so the list construct should be removed. Also, each parameter passed to exec is used as an individual parameter for the shell commandline, where the first parameter becomes the command (others depend on pipelining and redirections). As such, the current code will not allow for any parameters being sent to the shell command; ie "ls" will work, but "ls /home/" will not, as there is no binary known as "ls\ \/home\/".<br><br>This code should take care of the above mentioned issues. I would however like to emphasize the danger of providing means of remote code execution in this manner, as this could easily get your whole shell-account compromised by anyone simply matching any +n user record.<div class="codebox"><p>Code: </p><pre><code>bind pub n !shell shellcommandproc shellcommand {nick host handle channel text} { set cmdline [split $text] if {[catch {eval [linsert $cmdline 0 "exec"]} status]} {  puthelp "PRIVMSG $channel :Executed \"$text\" returned error status:"  foreach line [split $status "\n"] {   puthelp "PRIVMSG $channel :$line"  }  puthelp "PRIVMSG $channel :errorInfo:"  foreach line [split $::errorInfo "\n"] {   puthelp "PRIVMSG $channel :$line"  } } {  puthelp "PRIVMSG $channel :Executed \"$text\" returned ok status:"  foreach line [split $status "\n"] {   puthelp "PRIVMSG $channel :$line"  } }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Apr 29, 2009 8:37 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DaRkOoO]]></name></author>
		<updated>2009-04-29T07:16:42-04:00</updated>

		<published>2009-04-29T07:16:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88607#p88607</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88607#p88607"/>
		<title type="html"><![CDATA[Execute shell commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88607#p88607"><![CDATA[
&lt;DaRkOoO&gt; !shell ls <br>&lt;DaRkOoO&gt; !shell uptime<br><br><br>[13:09] Tcl error [shellcommand]: couldn't execute "{ls }": no such file or directory<br>[13:09] Tcl error [shellcommand]: unknown or ambiguous subcommand "llength": must be bytelength, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, reverse, tolower, totitle, toupper, trim, trimleft, trimright, wordend, or wordstart<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10236">DaRkOoO</a> — Wed Apr 29, 2009 7:16 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2009-04-28T16:48:18-04:00</updated>

		<published>2009-04-28T16:48:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88606#p88606</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88606#p88606"/>
		<title type="html"><![CDATA[Execute shell commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88606#p88606"><![CDATA[
<blockquote class="uncited"><div>It works,but..<br>&lt;snipped irrelevant parts&gt;<br>He paste just one line,never more..For example !shell who,he will paste just first line and then stop..Can that be fixed?</div></blockquote><div class="codebox"><p>Code: </p><pre><code>bind pub mn|- !shell shellcommandproc shellcommand { nick uhost handle chan text } {   set result [exec [list $text]]   if {[string llength $result]} {     foreach line [split $result "\n"] {       putserv "PRIVMSG $chan :$line"     }  }} </code></pre></div>Simply incorporate a foreach to split the result on newline, and putserv each line. Also changed that pub bind to only accept input from global owners or masters of your bot as well as adding list to the exec statement to avoid double substitution.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Tue Apr 28, 2009 4:48 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DaRkOoO]]></name></author>
		<updated>2009-04-28T08:10:27-04:00</updated>

		<published>2009-04-28T08:10:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88603#p88603</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88603#p88603"/>
		<title type="html"><![CDATA[Execute shell commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88603#p88603"><![CDATA[
It works,but..<br><br>&lt;DaRkOoO&gt; !shell ls /home/<br>&lt;DaRkOoO&gt; !shell ls<br>&lt;Genije&gt; Genije.chan<br><br>[14:01] Tcl error [shellcommand]: couldn't execute "ls /home": no such file or directory<br><br>He paste just one line,never more..For example !shell who,he will paste just first line and then stop..Can that be fixed?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10236">DaRkOoO</a> — Tue Apr 28, 2009 8:10 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raider2k]]></name></author>
		<updated>2009-04-28T00:38:42-04:00</updated>

		<published>2009-04-28T00:38:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88601#p88601</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88601#p88601"/>
		<title type="html"><![CDATA[Execute shell commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88601#p88601"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub - !shell shellcommandproc shellcommand { nick uhost handle chan text } {set docmd [exec $text]putserv "PRIVMSG $chan :$docmd"}</code></pre></div>is the easiest and simplest way of it all<br>just try and also notice that you wont be able at all to have a kind of shell-replacement<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9589">raider2k</a> — Tue Apr 28, 2009 12:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DaRkOoO]]></name></author>
		<updated>2009-04-27T10:48:15-04:00</updated>

		<published>2009-04-27T10:48:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88597#p88597</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88597#p88597"/>
		<title type="html"><![CDATA[Execute shell commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88597#p88597"><![CDATA[
What kind of informations you need?I simply want to bot react for example on !shell ls /home/ or !shell rm bla.txt or !shell uptime etc..He should just say result of that command on IRC channel..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10236">DaRkOoO</a> — Mon Apr 27, 2009 10:48 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raider2k]]></name></author>
		<updated>2009-04-27T09:28:42-04:00</updated>

		<published>2009-04-27T09:28:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88596#p88596</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88596#p88596"/>
		<title type="html"><![CDATA[Execute shell commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88596#p88596"><![CDATA[
then please supply enough information to have something to work on since the information you left in this post is not enough in my opinion<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9589">raider2k</a> — Mon Apr 27, 2009 9:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DaRkOoO]]></name></author>
		<updated>2009-04-27T09:13:46-04:00</updated>

		<published>2009-04-27T09:13:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88595#p88595</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88595#p88595"/>
		<title type="html"><![CDATA[Execute shell commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88595#p88595"><![CDATA[
I dont need something that will execute one specified command..I wanna to I be able to execute whatever command I want..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10236">DaRkOoO</a> — Mon Apr 27, 2009 9:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raider2k]]></name></author>
		<updated>2009-04-27T00:16:05-04:00</updated>

		<published>2009-04-27T00:16:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88592#p88592</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88592#p88592"/>
		<title type="html"><![CDATA[Execute shell commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88592#p88592"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>exec &lt;code-here&gt;</code></pre></div>in example<div class="codebox"><p>Code: </p><pre><code>set testing [exec rm /home/user/test.txt]putserv "PRIVMSG $chan :$testing"</code></pre></div>or<br><div class="codebox"><p>Code: </p><pre><code>set testing2 [exec some.sh]putserv "PRIVMSG $chan :$testing2"</code></pre></div>depends on what exactly you are trying to do, supply more information please. also there is more than just one way to get things done but - like i said - depends on what you are trying to do.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9589">raider2k</a> — Mon Apr 27, 2009 12:16 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DaRkOoO]]></name></author>
		<updated>2009-04-26T15:54:44-04:00</updated>

		<published>2009-04-26T15:54:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=88588#p88588</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=88588#p88588"/>
		<title type="html"><![CDATA[Execute shell commands]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=88588#p88588"><![CDATA[
Hi all,<br><br>I was wondering is there any script/module which will execute some shell command and say what it got on IRC.I saw people using .tcl exe ls /home/ ,so it is possible..I didnt found anything,except EggShell..But when I tried it,he leave every command active on shell and that process die when I kill egg..So I had problem with fork when I was using it..Is there any other solution?Maybe writing new tcl script?<br><br>Cheers,<br>Darko.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10236">DaRkOoO</a> — Sun Apr 26, 2009 3:54 pm</p><hr />
]]></content>
	</entry>
	</feed>
