Fix "protocol mismatch" issue

Credit: http://kbyte.snowpenguin.org/portal/2013/04/30/kippo-protocol-mismatch-workaround/
This commit is contained in:
g0tmi1k
2014-05-28 19:06:19 +01:00
parent 9645e500e0
commit 40b65278c3

View File

@@ -553,6 +553,24 @@ class HoneyPotTransport(transport.SSHServerTransport):
self.ttylog_open = False
transport.SSHServerTransport.connectionLost(self, reason)
def sendDisconnect(self, reason, desc):
"""
Workaround for the "bad packet length" error message.
@param reason: the reason for the disconnect. Should be one of the
DISCONNECT_* values.
@type reason: C{int}
@param desc: a descrption of the reason for the disconnection.
@type desc: C{str}
"""
if not 'bad packet length' in desc:
# With python >= 3 we can use super?
transport.SSHServerTransport.sendDisconnect(self, reason, desc)
else:
self.transport.write('Protocol mismatch.\n')
log.msg('Disconnecting with error, code %s\nreason: %s' % (reason, desc))
self.transport.loseConnection()
from twisted.conch.ssh.common import NS, getNS
class HoneyPotSSHUserAuthServer(userauth.SSHUserAuthServer):
def serviceStarted(self):