[Twisted-Python] twisted python conch SSH shell?
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
check out http://twistedmatrix.com/pipermail/twisted-python/2007-July/015793.html Eli Criffield On Tue, Aug 12, 2008 at 3:40 PM, Bill Zeller <wzeller@cs.princeton.edu> wrote:
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
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
participants (2)
-
Bill Zeller
-
Eli Criffield