From 342c95941ecdfdbdf34d1f684e6b394f19499574 Mon Sep 17 00:00:00 2001 From: desaster Date: Tue, 17 Nov 2009 05:58:27 +0000 Subject: [PATCH] Add fake exit git-svn-id: https://kippo.googlecode.com/svn/trunk@14 951d7100-d841-11de-b865-b3884708a8e2 --- commands/base.py | 3 ++- core/Kippo.py | 6 +++++- core/cmdl.py | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/commands/base.py b/commands/base.py index 75eb8ca6..d0c91978 100644 --- a/commands/base.py +++ b/commands/base.py @@ -97,7 +97,8 @@ class command_echo(HoneyPotCommand): class command_quit(HoneyPotCommand): def call(self, args): - self.honeypot.terminal.loseConnection() + self.honeypot.writeln('Connection to server closed.') + self.honeypot.prompt = 'localhost:%(path)s# ' class command_clear(HoneyPotCommand): def call(self, args): diff --git a/core/Kippo.py b/core/Kippo.py index 540e9812..2de0c9ae 100644 --- a/core/Kippo.py +++ b/core/Kippo.py @@ -19,6 +19,7 @@ class HoneyPotProtocol(recvline.HistoricRecvLine): self.env = env self.cwd = '/root' self.fs = HoneyPotFilesystem(deepcopy(self.env.fs)) + self.prompt = 'sales:%(path)s# ' def connectionMade(self): recvline.HistoricRecvLine.connectionMade(self) @@ -32,7 +33,10 @@ class HoneyPotProtocol(recvline.HistoricRecvLine): path = self.cwd if path == '/root': path = '~' - self.terminal.write('sales:%s# ' % path) + attrs = { + 'path': path, + } + self.terminal.write(self.prompt % attrs) def getCommandFunc(self, cmd): return getattr(self, 'do_' + cmd, None) diff --git a/core/cmdl.py b/core/cmdl.py index 76463375..5755f87b 100644 --- a/core/cmdl.py +++ b/core/cmdl.py @@ -6,6 +6,7 @@ cmdl = { '/bin/cat': base.command_cat, '/usr/bin/whoami': base.command_whoami, 'quit': base.command_quit, + 'exit': base.command_quit, '/usr/bin/clear': base.command_clear, '/bin/rm': base.command_rm, '/usr/bin/uptime': base.command_uptime,