Improved chmod - checks to see if file exists

:x
This commit is contained in:
g0tmi1k
2014-06-01 15:23:13 +01:00
committed by Upi Tamminen
parent b94419fc6e
commit 96f6d11c03

View File

@@ -291,10 +291,23 @@ class command_yes(HoneyPotCommand):
self.exit()
commands['/usr/bin/yes'] = command_yes
class command_chmod(HoneyPotCommand):
def call(self):
if len(self.args) and len(self.args) >= 2:
for arg in self.args[1:]:
path = self.fs.resolve_path(arg, self.honeypot.cwd)
if self.fs.exists(path):
continue
else:
self.writeln('chmod: cannot access %s: No such file or directory' % (arg,))
else:
self.writeln('chmod: missing operand')
self.writeln('Try chmod --help for more information.')
commands['/bin/chmod'] = command_chmod
class command_nop(HoneyPotCommand):
def call(self):
pass
commands['/bin/chmod'] = command_nop
commands['umask'] = command_nop
commands['set'] = command_nop
commands['unset'] = command_nop