New tasks for better customization of Telnet experience

This commit is contained in:
Olivier Bilodeau
2016-02-04 10:26:34 -05:00
committed by Michel Oosterhof
parent 97b6cd1bbd
commit 61318e3c21

View File

@@ -120,6 +120,7 @@ class HoneyPotTelnetAuthProtocol(AuthenticatingTelnetProtocol, TimeoutMixin):
# I need to doubly escape here since my underlying
# StripCrTelnetTransport hack would remove it and leave just \n
self.transport.write(self.factory.banner.replace('\n', '\r\r\n'))
# FIXME: this should be configurable or provided via filesystem
self.transport.write("User Access Verification\n\nUsername: ".replace('\n', '\r\r\n'))
self.setTimeout(120)
@@ -146,6 +147,7 @@ class HoneyPotTelnetAuthProtocol(AuthenticatingTelnetProtocol, TimeoutMixin):
# only send ECHO option if we are chatting with a real Telnet client
if self.transport.options:
self.transport.will(ECHO)
# FIXME: this should be configurable or provided via filesystem
self.transport.write("Password: ")
return 'Password'
@@ -188,6 +190,8 @@ class HoneyPotTelnetAuthProtocol(AuthenticatingTelnetProtocol, TimeoutMixin):
protocol.makeConnection(self.transport)
self.transport.protocol = protocol
# TODO: provide a way to have user configurable strings for wrong password
class StripCrTelnetTransport(TelnetTransport):
"""Sole purpose is to override write() and fix a CRLF nesting bug"""