From 35d853c8b90c5030dc2e329c4633559cfab0be50 Mon Sep 17 00:00:00 2001 From: Michel Oosterhof Date: Wed, 11 Mar 2015 13:03:43 +0000 Subject: [PATCH] fix hanging session on unknown exec command --- kippo/core/honeypot.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kippo/core/honeypot.py b/kippo/core/honeypot.py index 7b674531..2fd0ba3e 100644 --- a/kippo/core/honeypot.py +++ b/kippo/core/honeypot.py @@ -78,13 +78,17 @@ class HoneyPotShell(object): def runOrPrompt(): if len(self.cmdpending): self.runCommand() - else: + elif self.interactive: self.showPrompt() + else: + # transport.lostConnection is a bit overzealous. maybe close session? + self.honeypot.terminal.transport.loseConnection() 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() return @@ -125,12 +129,10 @@ class HoneyPotShell(object): rargs.append(arg) cmdclass = self.honeypot.getCommand(cmd, envvars['PATH'].split(':')) if cmdclass: - #log.msg( 'Command found: %s' % (line,) ) log.msg( eventid='KIPP0005', input=line, format='Command found: %(input)s' ) #self.honeypot.logDispatch('Command found: %s' % (line,)) self.honeypot.call_command(cmdclass, *rargs) else: - #log.msg( 'Command not found: %s' % (line,) ) log.msg( eventid='KIPP0006', input=line, format='Command not found: %(input)s' ) #self.honeypot.logDispatch('Command not found: %s' % (line,))