fix exit on unknown command (#1701)

Co-authored-by: Michel Oosterhof <michel@MacBook-Pro.local>
This commit is contained in:
Michel Oosterhof
2022-03-14 09:12:25 +08:00
committed by GitHub
parent fd966a52dd
commit 2b2b7415e9

View File

@ -317,6 +317,11 @@ class HoneyPotShell:
"utf8"
)
)
if not self.interactive:
stat = failure.Failure(error.ProcessDone(status=""))
self.protocol.terminal.transport.processEnded(stat)
runOrPrompt()
pp = None # Got a error. Don't run any piped commands
break
@ -374,10 +379,8 @@ class HoneyPotShell:
def handle_CTRL_D(self) -> None:
log.msg("Received CTRL-D, exiting..")
cmdclass = self.protocol.commands["exit"]
pp = StdOutStdErrEmulationProtocol(self.protocol, cmdclass, None, None, None)
self.protocol.call_command(pp, self.protocol.commands["exit"])
stat = failure.Failure(error.ProcessDone(status=""))
self.protocol.terminal.transport.processEnded(stat)
def handle_TAB(self) -> None:
"""