From 7f301dfc20029a57776cf1cf471f922e9e47b3a6 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Thu, 6 Oct 2016 13:51:16 -0700 Subject: [PATCH] fs: Remove symlink-handling logic from file_contents; that's handled by getfile. --- cowrie/core/fs.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cowrie/core/fs.py b/cowrie/core/fs.py index 323d8691..3a2e4abf 100644 --- a/cowrie/core/fs.py +++ b/cowrie/core/fs.py @@ -211,22 +211,18 @@ class HoneyPotFilesystem(object): return p - def file_contents(self, target, count=0): + def file_contents(self, target): """ Retrieve the content of a file in the honeyfs It follows links. It tries A_REALFILE first and then tries honeyfs directory """ - if count > 8: - raise TooManyLevels path = self.resolve_path(target, os.path.dirname(target)) if not path or not self.exists(path): raise FileNotFound f = self.getfile(path) if f[A_TYPE] == T_DIR: raise IsADirectoryError - elif f[A_TYPE] == T_LINK: - return self.file_contents(f[A_TARGET], count + 1) elif f[A_TYPE] == T_FILE and f[A_REALFILE]: return file(f[A_REALFILE], 'rb').read() realfile = self.realfile(f, '%s/%s' % \