mirror of https://github.com/cowrie/cowrie.git
after commands, close channel, don't kill session directly
This commit is contained in:
parent
aa11c54140
commit
347056a03d
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue