From 57345629971f105ce38b95a8d7708a7fe258f05f Mon Sep 17 00:00:00 2001 From: Andrew Case Date: Fri, 14 Aug 2020 14:42:29 -0500 Subject: [PATCH] Add mac.mount plugin --- volatility/framework/plugins/mac/mount.py | 57 +++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 volatility/framework/plugins/mac/mount.py diff --git a/volatility/framework/plugins/mac/mount.py b/volatility/framework/plugins/mac/mount.py new file mode 100644 index 000000000..36b368cfe --- /dev/null +++ b/volatility/framework/plugins/mac/mount.py @@ -0,0 +1,57 @@ +# This file is Copyright 2019 Volatility Foundation and licensed under the Volatility Software License 1.0 +# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0 +# +"""A module containing a collection of plugins that produce data typically +found in Mac's mount command.""" +from volatility.framework import renderers, interfaces, contexts +from volatility.framework.configuration import requirements +from volatility.framework.interfaces import plugins +from volatility.framework.objects import utility +from volatility.framework.renderers import format_hints +from volatility.framework.symbols import mac + +class Mount(plugins.PluginInterface): + """A module containing a collection of plugins that produce data typically + foundin Mac's mount command""" + + _version = (1, 0, 0) + + @classmethod + def get_requirements(cls): + return [ + requirements.TranslationLayerRequirement(name = 'primary', + description = 'Memory layer for the kernel', + architectures = ["Intel32", "Intel64"]), + requirements.SymbolTableRequirement(name = "darwin", description = "Mac kernel symbols") + ] + + @classmethod + def list_mounts(cls, context: interfaces.context.ContextInterface, layer_name: str, darwin_symbols: str): + """Lists all the mount structures in the primary layer. + + Args: + context: The context to retrieve required elements (layers, symbol tables) from + layer_name: The name of the layer on which to operate + darwin_symbols: The name of the table containing the kernel symbols + + Returns: + A list of mount structures from the `layer_name` layer + """ + kernel = contexts.Module(context, darwin_symbols, layer_name, 0) + + list_head = kernel.object_from_symbol(symbol_name = "mountlist") + + for mount in mac.MacUtilities.walk_tailq(list_head, "mnt_list"): + yield mount + + def _generator(self): + for mount in self.list_mounts(self.context, self.config['primary'], self.config['darwin']): + vfs = mount.mnt_vfsstat + device_name = utility.array_to_string(vfs.f_mntonname) + mount_point = utility.array_to_string(vfs.f_mntfromname) + mount_type = utility.array_to_string(vfs.f_fstypename) + + yield 0, (device_name, mount_point, mount_type) + + def run(self): + return renderers.TreeGrid([("Device", str), ("Mount Point", str), ("Type", str)], self._generator())