mirror of https://github.com/cowrie/cowrie.git
fix hanging session on unknown exec command
This commit is contained in:
parent
60932db100
commit
35d853c8b9
|
@ -78,13 +78,17 @@ class HoneyPotShell(object):
|
||||||
def runOrPrompt():
|
def runOrPrompt():
|
||||||
if len(self.cmdpending):
|
if len(self.cmdpending):
|
||||||
self.runCommand()
|
self.runCommand()
|
||||||
else:
|
elif self.interactive:
|
||||||
self.showPrompt()
|
self.showPrompt()
|
||||||
|
else:
|
||||||
|
# transport.lostConnection is a bit overzealous. maybe close session?
|
||||||
|
self.honeypot.terminal.transport.loseConnection()
|
||||||
|
|
||||||
if not len(self.cmdpending):
|
if not len(self.cmdpending):
|
||||||
if self.interactive:
|
if self.interactive:
|
||||||
self.showPrompt()
|
self.showPrompt()
|
||||||
else:
|
else:
|
||||||
|
# transport.lostConnection is a bit overzealous. maybe close session?
|
||||||
self.honeypot.terminal.transport.loseConnection()
|
self.honeypot.terminal.transport.loseConnection()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -125,12 +129,10 @@ class HoneyPotShell(object):
|
||||||
rargs.append(arg)
|
rargs.append(arg)
|
||||||
cmdclass = self.honeypot.getCommand(cmd, envvars['PATH'].split(':'))
|
cmdclass = self.honeypot.getCommand(cmd, envvars['PATH'].split(':'))
|
||||||
if cmdclass:
|
if cmdclass:
|
||||||
#log.msg( 'Command found: %s' % (line,) )
|
|
||||||
log.msg( eventid='KIPP0005', input=line, format='Command found: %(input)s' )
|
log.msg( eventid='KIPP0005', input=line, format='Command found: %(input)s' )
|
||||||
#self.honeypot.logDispatch('Command found: %s' % (line,))
|
#self.honeypot.logDispatch('Command found: %s' % (line,))
|
||||||
self.honeypot.call_command(cmdclass, *rargs)
|
self.honeypot.call_command(cmdclass, *rargs)
|
||||||
else:
|
else:
|
||||||
#log.msg( 'Command not found: %s' % (line,) )
|
|
||||||
log.msg( eventid='KIPP0006',
|
log.msg( eventid='KIPP0006',
|
||||||
input=line, format='Command not found: %(input)s' )
|
input=line, format='Command not found: %(input)s' )
|
||||||
#self.honeypot.logDispatch('Command not found: %s' % (line,))
|
#self.honeypot.logDispatch('Command not found: %s' % (line,))
|
||||||
|
|
Loading…
Reference in New Issue