Refuse to enable SGA and LINEMODE during authentication (#415)

Some telnet clients attempt to initiate negotiation about SGA and LINEMODE themselves, but only when a port isn't specified on the command line. If we allow them to enable SGA or LINEMODE, they change from sending a newline character when enter is pressed to sending a carriage return.  Cowrie can't handle this properly at the login prompt, which prevents the client from being able to login.

I left the old code commented out so it is easier re-enable once Cowrie/Twisted support the Telnet protocol better.

Fixes #414
This commit is contained in:
lelonek1 2017-01-21 01:30:31 -05:00 committed by Michel Oosterhof
parent 2152a73cc6
commit c58056b01a
1 changed files with 5 additions and 3 deletions

View File

@ -180,15 +180,17 @@ class HoneyPotTelnetAuthProtocol(AuthenticatingTelnetProtocol):
if opt == ECHO:
return True
elif opt == SGA:
return True
return False
#return True
else:
return False
def enableRemote(self, opt):
if opt == LINEMODE:
self.transport.requestNegotiation(LINEMODE, MODE + chr(TRAPSIG))
return True
return False
#self.transport.requestNegotiation(LINEMODE, MODE + chr(TRAPSIG))
#return True
elif opt == NAWS:
return True
elif opt == SGA: