[Twisted-Python] Using twisted.conch.recvline

Jp Calderone exarkun at divmod.com
Wed Jun 1 17:24:07 EDT 2005

On Tue, 31 May 2005 17:52:46 -0400, Abe Fettig <abe at fettig.net> wrote:
>Hello all,
>I'm trying to figure out how to hook up the necessary classes in
>twisted.conch.recvline to add line-editing and history to a simple ssh
>app. It was easy to modify
>to use a custom protocol (a simple command-line interface that sends web
>services requests to a JotSpot wiki), but I can't figure out how
>recvline is meant to be used. Could someone (Jp?) show me how you'd go
>about bolting recvline onto sshsimpleserver?

In summary, you need:

  1) A Realm which produces avatars implementing IConchUser
  2) An avatar which also implements or is adaptable to ISession
  3) A session which constructs a twisted.conch.insults.insults.ServerProtocol in openShell, and connects it to a transport
  4) A protocol class which subclasses one of the recvline protocol classes, passed as the first argument to ServerProtocol

If you hook all these pieces up right, the protocol class you give to ServerProtocol should end up receiving application-level data from your ssh server, and its terminal attribute will be hooked up to send bytes back.

Note that this API may not be stable.

There's an example of all this smeared across doc/conch/examples/demo_recvline.py and twisted/conch/manhole_ssh.py.

The API presented by manhole_ssh.py is definitely not stable.


More information about the Twisted-Python mailing list