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:
desaster
2009-11-11 05:47:34 +00:00
parent 393a33ff02
commit e90538042f
3 changed files with 211078 additions and 146125 deletions

View File

@@ -30,7 +30,7 @@ class command_cd(HoneyPotCommand):
try:
newpath = self.honeypot.fs.resolve_path(args, self.honeypot.cwd)
newdir = self.honeypot.fs.get_path(newpath)
except:
except IndexError:
newdir = None
if newdir is None:
@@ -43,7 +43,12 @@ class command_rm(HoneyPotCommand):
def call(self, args):
for f in args.split(' '):
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]
contents = [x for x in dir]
for i in dir[:]: