mirror of
https://github.com/aljazceru/cowrie.git
synced 2026-01-07 08:14:23 +01:00
Added is_link() to core/fs.py to enable cd into symbolic link in
commands/fs.py
This commit is contained in:
@@ -52,6 +52,9 @@ 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):
|
||||
f = self.fs.getfile(newpath)
|
||||
newpath = f[A_TARGET]
|
||||
if not self.fs.is_dir(newpath):
|
||||
self.writeln('bash: cd: %s: Not a directory' % path)
|
||||
return
|
||||
|
||||
@@ -185,6 +185,13 @@ class HoneyPotFilesystem(object):
|
||||
self.newcount += 1
|
||||
return True
|
||||
|
||||
def is_link(self, path):
|
||||
try:
|
||||
f = self.getfile(path)
|
||||
except:
|
||||
return False
|
||||
return f[A_TYPE] == T_LINK
|
||||
|
||||
def is_dir(self, path):
|
||||
if path == '/':
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user