Merge branch 'bash' of https://github.com/g0tmi1k/kippo into g0tmi1k-bash

This commit is contained in:
Upi Tamminen 2014-06-13 18:07:41 +03:00
commit e4d4ea4b2e
3 changed files with 7 additions and 4 deletions

View File

@ -78,7 +78,7 @@ commands['/bin/hostname'] = command_hostname
class command_uname(HoneyPotCommand):
def call(self):
if len(self.args) and self.args[0].strip() == '-a':
if len(self.args) and (self.args[0].strip() == '-a' or self.args[0].strip() == '--all'):
self.writeln(
'Linux %s 2.6.26-2-686 #1 SMP Wed Nov 4 20:45:37 UTC 2009 i686 GNU/Linux' % \
self.honeypot.hostname)

View File

@ -25,7 +25,7 @@ commands['/bin/cat'] = command_cat
class command_cd(HoneyPotCommand):
def call(self):
if not self.args:
if not self.args or self.args[0] == "~":
path = self.honeypot.user.home
else:
path = self.args[0]
@ -34,11 +34,14 @@ class command_cd(HoneyPotCommand):
newdir = self.fs.get_path(newpath)
except IndexError:
newdir = None
if path == "-":
self.writeln('bash: cd: OLDPWD not set')
return
if newdir is None:
self.writeln('bash: cd: %s: No such file or directory' % path)
return
if not self.fs.is_dir(newpath):
self.writeln('-bash: cd: %s: Not a directory' % path)
self.writeln('bash: cd: %s: Not a directory' % path)
return
self.honeypot.cwd = newpath
commands['cd'] = command_cd

View File

@ -90,7 +90,7 @@ class HoneyPotShell(object):
cmdAndArgs = shlex.split(line)
except:
self.honeypot.writeln(
'-bash: syntax error: unexpected end of file')
'bash: syntax error: unexpected end of file')
# could run runCommand here, but i'll just clear the list instead
self.cmdpending = []
self.showPrompt()