<div dir="ltr">Hi,<br><br>I&#39;ve been playing around with Twisted&#39;s Conch client (which looks extremely well done, thanks!). I&#39;ve been able to connect to a conch server and also connect to other ssh servers and execuate various commands. I&#39;d like to be able to connect to an arbitrary SSH server and run /bin/bash.<br>
<br>I&#39;m able to execute a command like so:<br><br>---------------------<br>class CommandChannel(channel.SSHChannel):<br>&nbsp;&nbsp;&nbsp; ....<br>&nbsp;&nbsp;&nbsp; def channelOpen(self, data):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.conn.sendRequest(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self, &#39;exec&#39;, common.NS(self.command), wantReply=True).addCallback(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self._gotResponse)<br>---------------------<br><br>Looking through the SSH spec (connect protocol, rfc4254), it looks like shells are opened with this command. <br><br>---------------------<br><br><pre>      byte      SSH_MSG_CHANNEL_REQUEST<br>
      uint32    recipient channel<br>      string    &quot;shell&quot;<br>      boolean   want reply<br></pre>
---------------------<br><br>It doesn&#39;t look like Conch supports these requests (here&#39;s how CHANNEL_REQUESTs are currently sent out)<br><br>---------------------<br>(Twisted-8.1.0)<br>twisted/conch/ssh/connection.py (413):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.transport.sendPacket(MSG_CHANNEL_REQUEST, struct.pack(&#39;&gt;L&#39;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.channelsToRemoteChannel[channel])<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + common.NS(requestType)+chr(wantReply)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + data)<br>---------------------<br><br>I may be misunderstanding how remote shells are started, so any help would be appreciated. <br><br>Again, I&#39;m trying to launch an interactive /bin/bash shell from a Conch SSH client on an arbitrary remote SSH server. <br>
<br>Thanks for your time.<br><br>Best Regards,<br>Bill Zeller<br></div>