mirror of
https://github.com/aljazceru/cowrie.git
synced 2026-01-07 16:24:28 +01:00
Support for multiple symlink levels in command_cd
This commit is contained in:
@@ -52,9 +52,13 @@ class command_cd(HoneyPotCommand):
|
||||
if newdir is None:
|
||||
self.writeln('bash: cd: %s: No such file or directory' % path)
|
||||
return
|
||||
if self.fs.is_link(newpath):
|
||||
count = 0
|
||||
while self.fs.is_link(newpath):
|
||||
f = self.fs.getfile(newpath)
|
||||
newpath = f[A_TARGET]
|
||||
count += 1
|
||||
if count > 10:
|
||||
raise self.fs.TooManyLevels
|
||||
if not self.fs.is_dir(newpath):
|
||||
self.writeln('bash: cd: %s: Not a directory' % path)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user