I haven't worked with the telnet protocol since the 1.x series honestly and I remember having to add a good bit of code to support all the control functions in order to get things working as nicely as I wanted. That aside, echo (or lack thereof) did work fine, but "will" will not force a client to do anything. I believe you need to use "do"/"dont" to get the effect you desire.
-- James Tanis Technical Coordinator Computer Science Department Monsignor Donovan Catholic High School On Nov 16, 2009, at 9:14 AM, [email protected] wrote: > Hello, > > Some month ago, exarkun helped me in the development of a very simplified > telnet server. > > I observed that when I connect from a windows client, the LOCALECHO > is set to "OFF" after the authentication. I cannot set it "ON" > afterwards. Everything typed in the client console is hidden. > When I use a linux client, the "ECHO" is OFF just for typing the > password and then ON again. > > Does someone has an idea how to do with the windows client? > I tried to set the ECHO ON using self.transport.will(ECHO) but that > doesn't work. > > Here is the code: > > ############################################################ > import sys > from zope.interface import implements > from twisted.internet import protocol > from twisted.python import log > from twisted.cred import error > from twisted.cred import portal > from twisted.cred import checkers > from twisted.cred import credentials > from twisted.conch.telnet import AuthenticatingTelnetProtocol > from twisted.conch.telnet import StatefulTelnetProtocol > from twisted.conch.telnet import ITelnetProtocol > from twisted.conch.telnet import TelnetTransport > from twisted.conch.telnet import ECHO > > class Realm: > implements(portal.IRealm) > > def requestAvatar(self, avatarId, mind, *interfaces): > if ITelnetProtocol in interfaces: > av = MyTelnet() > av.transport.will(ECHO) > av.state = 'Command' > return ITelnetProtocol, av, lambda:None > raise NotImplementedError("Not supported by this realm") > > class MyTelnet(StatefulTelnetProtocol): > def telnet_Command(self, line): > print "line received via telnet", line > self.sendLine('coucou man, you send me %s' % line) > > def main(): > r = Realm() > p = portal.Portal(r) > c = checkers.InMemoryUsernamePasswordDatabaseDontUse() > c.addUser("AA", "aa") > p.registerChecker(c) > p.registerChecker(checkers.AllowAnonymousAccess()) > f = protocol.ServerFactory() > f.protocol = lambda: TelnetTransport(AuthenticatingTelnetProtocol, p) > log.startLogging(sys.stdout) > from twisted.internet import reactor > reactor.listenTCP(4738, f) > reactor.run() > > if __name__ == '__main__': > main() > ############################################################ > > Best Regards, > Philippe > > > > > _______________________________________________ > Twisted-Python mailing list > [email protected] > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
_______________________________________________ Twisted-Python mailing list [email protected] http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
