Add fake exit

git-svn-id: https://kippo.googlecode.com/svn/trunk@14 951d7100-d841-11de-b865-b3884708a8e2
This commit is contained in:
desaster 2009-11-17 05:58:27 +00:00
parent 90172c1d2b
commit 342c95941e
3 changed files with 8 additions and 2 deletions

View File

@ -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):

View File

@ -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)

View File

@ -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,