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

Commit d5b5ad8

Browse files
pagabucFabio
authored andcommitted
Handling kuid_t/kgid_t types in struct inode
1 parent 73cc683 commit d5b5ad8

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

volatility/plugins/linux/dentry_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def make_body(self, dentry):
4747
i = dentry.d_inode
4848

4949
if i:
50-
ret = [0, path, i.i_ino, 0, i.i_uid, i.i_gid, i.i_size, i.i_atime, i.i_mtime, 0, i.i_ctime]
50+
ret = [0, path, i.i_ino, 0, i.uid, i.gid, i.i_size, i.i_atime, i.i_mtime, 0, i.i_ctime]
5151
else:
5252
ret = [0, path] + [0] * 8
5353

volatility/plugins/linux/recover_filesystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def _fix_metadata(self, file_path, file_dentry):
4747
out_path = os.path.join(self._config.DUMP_DIR, *ents)
4848

4949
os.chmod(out_path, inode.i_mode & 00777)
50-
os.chown(out_path, inode.i_uid, inode.i_gid)
50+
os.chown(out_path, inode.uid, inode.gid)
5151
os.utime(out_path, (inode.i_atime.tv_sec, inode.i_mtime.tv_sec))
5252

5353
def _write_file(self, ff, file_path, file_dentry):

volatility/plugins/overlays/linux/linux.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,7 +2244,25 @@ def minor(self):
22442244
return self.s_dev & ((1 << 20) - 1)
22452245

22462246
class inode(obj.CType):
2247+
@property
2248+
def uid(self):
2249+
2250+
try:
2251+
ret = int(self.i_uid)
2252+
except TypeError:
2253+
ret = int(self.i_uid.val)
2254+
2255+
return ret
22472256

2257+
@property
2258+
def gid(self):
2259+
2260+
try:
2261+
ret = int(self.i_gid)
2262+
except TypeError:
2263+
ret = int(self.i_gid.val)
2264+
return ret
2265+
22482266
def is_dir(self):
22492267
"""Mimic the S_ISDIR macro"""
22502268
return self.i_mode & linux_flags.S_IFMT == linux_flags.S_IFDIR

0 commit comments

Comments
 (0)