Skip to content
This repository was archived by the owner on May 16, 2025. It is now read-only.

Commit b87c464

Browse files
committed
Update mount enumeration v2
1 parent 1cd33e0 commit b87c464

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

volatility/plugins/linux/common.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def walk_internal_list(struct_name, list_member, list_start, addr_space = None):
144144
list_start = getattr(list_struct, list_member)
145145

146146
# based on __d_path
147-
def do_get_path(rdentry, rmnt, dentry, vfsmnt):
147+
def do_get_path(dentry, rmnt, rdentry, vfsmnt):
148148
ret_path = []
149149

150150
inode = dentry.d_inode
@@ -153,16 +153,16 @@ def do_get_path(rdentry, rmnt, dentry, vfsmnt):
153153
return []
154154

155155
while (dentry != rdentry or vfsmnt != rmnt) and dentry.d_name.name.is_valid():
156-
dname = dentry.d_name.name.dereference_as("String", length = MAX_STRING_LENGTH)
157-
158-
ret_path.append(dname.strip('/'))
159-
160156
if dentry == vfsmnt.mnt_root or dentry == dentry.d_parent:
157+
ret_path.append('')
161158
if vfsmnt.mnt_parent == vfsmnt.v():
162159
break
163160
dentry = vfsmnt.mnt_mountpoint
164161
vfsmnt = vfsmnt.mnt_parent
165162
continue
163+
164+
dname = dentry.d_name.name.dereference_as("String", length = MAX_STRING_LENGTH)
165+
ret_path.append(dname.strip('/'))
166166

167167
parent = dentry.d_parent
168168
dentry = parent

volatility/plugins/linux/mount.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,7 @@ def _parse_mnt(self, mnt, ns, fs_types):
6767
if not fstype.is_valid():
6868
return ret
6969

70-
#print fs_types
71-
#if str(fstype) not in fs_types:
72-
# return ret
73-
7470
path = linux_common.do_get_path(mnt.mnt_sb.s_root, mnt.mnt_parent, mnt.mnt_root, mnt)
75-
7671
if path == []:
7772
return ret
7873

@@ -173,7 +168,7 @@ def calculate(self):
173168
for t in tmp_mnts:
174169
tt = t.mnt_devname.dereference_as("String", length = linux_common.MAX_STRING_LENGTH)
175170
if tt:
176-
if len(str(tt)) > 2:
171+
if len(str(tt)) > 2 or str(tt)[0] == '/':
177172
all_mnts.append(t)
178173

179174
list_mnts = {}

0 commit comments

Comments
 (0)