From 88f1166c6dde25170ede0385532f66dfdcf43635 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Sun, 4 Dec 2016 01:01:13 +0000 Subject: [PATCH] Add in a helper function that will likely be useful in the future. --- volatility/framework/interfaces/configuration.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/volatility/framework/interfaces/configuration.py b/volatility/framework/interfaces/configuration.py index 7a93d97e3..6dcc20df8 100644 --- a/volatility/framework/interfaces/configuration.py +++ b/volatility/framework/interfaces/configuration.py @@ -22,6 +22,14 @@ def path_join(*args): return CONFIG_SEPARATOR.join(args) +def path_depth(path, depth = 1): + """Returns the path up to a certain depth + + Note that depth can be negative (such as -x) and will return all elements except for the last x + """ + return path_join(path.split(CONFIG_SEPARATOR)[:depth]) + + class RequirementInterface(validity.ValidityRoutines, metaclass = ABCMeta): """Class to distinguish configuration elements from everything else"""