[Twisted-Python] Telnet server using Twisted and AuthenticatingTelnetProtocol
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Thu Aug 20 10:48:21 MDT 2009
On 07:07 am, filoufake-python at yahoo.fr wrote:
>Hello,
>
>I have created a telnet server in python.
>
>Maybe you wonder why to create a telnet server while Windows has one?
>Because the windows telnet server does not allow to interract with the
>desktop. If you try to start a GUI app, it will start and run but will
>not be displayed on the server desktop.
>
>My telnet server will allow to start a GUI application interracting
>with the windows desktop of the server.
>Ex. : typing "notepad" in the telnet console will pop up the notepad on
>the Windows desktop of the server.
>
>At the time this server works but has no authentication feature
>implemented.
>
>I would like to implement the authentication using
>AuthenticatingTelnetProtocol and credential.
>I found the "cred.py" example on the twistedmatrix website (in the
>example section) and looked fine as starting point.
>
>I quite well understand this expample.
>
>I modified the code as follow but always got the same error message
>when a connectiion is attempted.
>I have been trying since two weeks but I cannot get it work.
>
>Is there a problem with "AuthenticatingTelnetProtocol"
AuthenticatingTelnetProtocol requires an argument to its constructor -
the cred portal to use to do the authentication and authorization with.
However, ServerFactory.buildProtocol doesn't invoke it with any
arguments, so you get a TypeError. You can fix this by making your
factory's protocol be a no-argument callable instead - eg, by making it
a lambda that closes over the portal or the factory:
def __init__(self, portal):
self.protocol = lambda: AuthenticatingTelnetProtocol(portal)
However, this won't completely fix your problems.
AuthenticatingTelnetProtocol expects to be connected to an
ITelnetTransport, not an ITCPTransport.
http://twistedmatrix.com/trac/browser/branches/telnet-server-
example-3940/doc/conch/examples/telnet_echo.tac might help illuminate
the way telnet transports and telnet protocols are intended to be
assembled.
Jean-Paul
More information about the Twisted-Python
mailing list