mirror of
https://github.com/aljazceru/cowrie.git
synced 2026-02-23 07:14:24 +01:00
allow recursive rm
git-svn-id: https://kippo.googlecode.com/svn/trunk@70 951d7100-d841-11de-b865-b3884708a8e2
This commit is contained in:
@@ -53,6 +53,10 @@ commands['cd'] = command_cd
|
||||
|
||||
class command_rm(HoneyPotCommand):
|
||||
def call(self):
|
||||
recursive = False
|
||||
for f in self.args:
|
||||
if f.startswith('-') and 'r' in f:
|
||||
recursive = True
|
||||
for f in self.args:
|
||||
path = self.fs.resolve_path(f, self.honeypot.cwd)
|
||||
try:
|
||||
@@ -65,7 +69,7 @@ class command_rm(HoneyPotCommand):
|
||||
contents = [x for x in dir]
|
||||
for i in dir[:]:
|
||||
if i[A_NAME] == basename:
|
||||
if i[A_TYPE] == T_DIR:
|
||||
if i[A_TYPE] == T_DIR and not recursive:
|
||||
self.writeln(
|
||||
'rm: cannot remove `%s\': Is a directory' % \
|
||||
i[A_NAME])
|
||||
|
||||
Reference in New Issue
Block a user