[Twisted-Python] Using telnet or linereceiver protocol over ssh

Fabian Sturm f at rtfs.org
Sat Jan 5 15:22:49 EST 2013


Hi Glyph

Am Montag, den 31.12.2012, 00:54 -0800 schrieb Glyph:

> Have you looked at HistoricRecvLine <https://twistedmatrix.com/documents/current/api/twisted.conch.recvline.HistoricRecvLine.html>?

No I didn't find that! This is exaclty what I was looking for :-) I knew
there had to be something better then writing this myself.

I just had some trouble wiring it up, but it now finally works. For
reference, what I did was to add this code to the openSSH method:

    def openShell(self, protocol):
        serverProtocol = ServerProtocol(MyRecvLine, self)
        serverProtocol.makeConnection(protocol)
        protocol.makeConnection(session.wrapProtocol(serverProtocol))

And MyRecvLine is a subclass of HistoricRecvLine.

> It's not the easiest class to use, but it should do basically what you need, with various line-editing niceties.

> This is also an area that could really benefit from some more maintenance, both in the code and the documentation; writing a command-line interface to Twisted should be a lot easier and more obvious.  So if you'd like to contribute to Twisted this is a good place to start :).

Yeah definitively, documentation is sorely needed. For this I already
bought the upcoming Twisted book. I hope that this will give me some
more insight why I have to do some of the things the way they are.
Unfortunately I am not sure if I am the right one for documentation
since I still struggle with some of the concepts. But I would like to
publish this combined sftp and command server as a reference.

Sincerely,
Fabian




More information about the Twisted-Python mailing list