mirror of
https://github.com/aljazceru/cowrie.git
synced 2025-12-18 06:24:20 +01:00
Add "file not found" for rm
New commands: set, unset, history, export git-svn-id: https://kippo.googlecode.com/svn/trunk@5 951d7100-d841-11de-b865-b3884708a8e2
This commit is contained in:
@@ -30,7 +30,7 @@ class command_cd(HoneyPotCommand):
|
|||||||
try:
|
try:
|
||||||
newpath = self.honeypot.fs.resolve_path(args, self.honeypot.cwd)
|
newpath = self.honeypot.fs.resolve_path(args, self.honeypot.cwd)
|
||||||
newdir = self.honeypot.fs.get_path(newpath)
|
newdir = self.honeypot.fs.get_path(newpath)
|
||||||
except:
|
except IndexError:
|
||||||
newdir = None
|
newdir = None
|
||||||
|
|
||||||
if newdir is None:
|
if newdir is None:
|
||||||
@@ -43,7 +43,12 @@ class command_rm(HoneyPotCommand):
|
|||||||
def call(self, args):
|
def call(self, args):
|
||||||
for f in args.split(' '):
|
for f in args.split(' '):
|
||||||
path = self.honeypot.fs.resolve_path(f, self.honeypot.cwd)
|
path = self.honeypot.fs.resolve_path(f, self.honeypot.cwd)
|
||||||
dir = self.honeypot.fs.get_path('/'.join(path.split('/')[:-1]))
|
try:
|
||||||
|
dir = self.honeypot.fs.get_path('/'.join(path.split('/')[:-1]))
|
||||||
|
except IndexError:
|
||||||
|
self.honeypot.writeln(
|
||||||
|
'rm: cannot remove `%s\': No such file or directory' % f)
|
||||||
|
continue
|
||||||
basename = path.split('/')[-1]
|
basename = path.split('/')[-1]
|
||||||
contents = [x for x in dir]
|
contents = [x for x in dir]
|
||||||
for i in dir[:]:
|
for i in dir[:]:
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ cmdl = {
|
|||||||
'/bin/mount': base.command_mount,
|
'/bin/mount': base.command_mount,
|
||||||
'/bin/pwd': base.command_pwd,
|
'/bin/pwd': base.command_pwd,
|
||||||
'/bin/uname': base.command_uname,
|
'/bin/uname': base.command_uname,
|
||||||
|
'set': base.command_nop,
|
||||||
|
'unset': base.command_nop,
|
||||||
|
'history': base.command_nop,
|
||||||
|
'export': base.command_nop,
|
||||||
'/bin/ls': ls.command_ls,
|
'/bin/ls': ls.command_ls,
|
||||||
'/usr/bin/wget': wget.command_wget,
|
'/usr/bin/wget': wget.command_wget,
|
||||||
'/bin/tar': tar.command_tar,
|
'/bin/tar': tar.command_tar,
|
||||||
|
|||||||
Reference in New Issue
Block a user