[Twisted-Python] twisted python conch SSH shell?

Bill Zeller wzeller at cs.princeton.edu
Tue Aug 12 16:40:19 EDT 2008


Hi,

I've been playing around with Twisted's Conch client (which looks extremely
well done, thanks!). I've been able to connect to a conch server and also
connect to other ssh servers and execuate various commands. I'd like to be
able to connect to an arbitrary SSH server and run /bin/bash.

I'm able to execute a command like so:

---------------------
class CommandChannel(channel.SSHChannel):
    ....
    def channelOpen(self, data):
        self.conn.sendRequest(
            self, 'exec', common.NS(self.command),
wantReply=True).addCallback(
            self._gotResponse)
---------------------

Looking through the SSH spec (connect protocol, rfc4254), it looks like
shells are opened with this command.

---------------------

      byte      SSH_MSG_CHANNEL_REQUEST
      uint32    recipient channel
      string    "shell"
      boolean   want reply

---------------------

It doesn't look like Conch supports these requests (here's how
CHANNEL_REQUESTs are currently sent out)

---------------------
(Twisted-8.1.0)
twisted/conch/ssh/connection.py (413):
        self.transport.sendPacket(MSG_CHANNEL_REQUEST, struct.pack('>L',
                                    self.channelsToRemoteChannel[channel])
                                  + common.NS(requestType)+chr(wantReply)
                                  + data)
---------------------

I may be misunderstanding how remote shells are started, so any help would
be appreciated.

Again, I'm trying to launch an interactive /bin/bash shell from a Conch SSH
client on an arbitrary remote SSH server.

Thanks for your time.

Best Regards,
Bill Zeller
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20080812/68837d32/attachment.htm 


More information about the Twisted-Python mailing list