From 6b1120824a52e4726d2d7522d2cbaea9aca520a5 Mon Sep 17 00:00:00 2001 From: desaster Date: Wed, 25 Nov 2009 17:10:55 +0000 Subject: [PATCH] * ctrl-c should empty the line buffer * don't add lines to history if within a command git-svn-id: https://kippo.googlecode.com/svn/trunk@78 951d7100-d841-11de-b865-b3884708a8e2 --- kippo/core/honeypot.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kippo/core/honeypot.py b/kippo/core/honeypot.py index 866dcab6..0329f107 100644 --- a/kippo/core/honeypot.py +++ b/kippo/core/honeypot.py @@ -113,6 +113,8 @@ class HoneyPotShell(object): self.honeypot.terminal.write(prompt % attrs) def ctrl_c(self): + self.honeypot.lineBuffer = [] + self.honeypot.lineBufferIndex = 0 self.honeypot.terminal.nextLine() self.showPrompt() @@ -188,6 +190,13 @@ class HoneyPotProtocol(recvline.HistoricRecvLine): self.terminal.write(data) self.terminal.nextLine() + def handle_RETURN(self): + if len(self.cmdstack) == 1: + if self.lineBuffer: + self.historyLines.append(''.join(self.lineBuffer)) + self.historyPosition = len(self.historyLines) + return recvline.RecvLine.handle_RETURN(self) + class LoggingServerProtocol(insults.ServerProtocol): def connectionMade(self): self.ttylog_file = '%s/tty/%s-%s.log' % \