diff --git a/kippo/core/honeypot.py b/kippo/core/honeypot.py index 2fd0ba3e..8a741750 100644 --- a/kippo/core/honeypot.py +++ b/kippo/core/honeypot.py @@ -81,15 +81,15 @@ class HoneyPotShell(object): elif self.interactive: self.showPrompt() else: - # transport.lostConnection is a bit overzealous. maybe close session? - self.honeypot.terminal.transport.loseConnection() + self.honeypot.terminal.transport.session.sendEOF() + self.honeypot.terminal.transport.session.sendClose() if not len(self.cmdpending): if self.interactive: self.showPrompt() else: - # transport.lostConnection is a bit overzealous. maybe close session? - self.honeypot.terminal.transport.loseConnection() + self.honeypot.terminal.transport.session.sendEOF() + self.honeypot.terminal.transport.session.sendClose() return line = self.cmdpending.pop(0) diff --git a/kippo/core/ssh.py b/kippo/core/ssh.py index cb38fc22..3d1f3ad2 100644 --- a/kippo/core/ssh.py +++ b/kippo/core/ssh.py @@ -279,6 +279,14 @@ class HoneyPotSSHSession(session.SSHSession): def closed(self): session.SSHSession.closed(self) + # utility function to request to send EOF for this session + def sendEOF(self): + self.conn.sendEOF(self) + + # utility function to request to send close for this session + def sendClose(self): + self.conn.sendClose(self) + def loseConnection(self): self.conn.sendRequest(self, 'exit-status', "\x00"*4) session.SSHSession.loseConnection(self)