From d37732e9b69a0c8f1d3a8e02c55cda7a2550a3ad Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Fri, 21 Apr 2017 00:01:12 +0100 Subject: [PATCH] Add in array_to_string helper function. --- volatility/framework/objects/utility.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 volatility/framework/objects/utility.py diff --git a/volatility/framework/objects/utility.py b/volatility/framework/objects/utility.py new file mode 100644 index 000000000..d8792447f --- /dev/null +++ b/volatility/framework/objects/utility.py @@ -0,0 +1,9 @@ +from volatility.framework.objects import Array + + +def array_to_string(array, errors = 'replace'): + """Takes a volatility Array of characters and returns a string""" + # TODO: Consider checking the Array's target is a native char + if not isinstance(array, Array): + raise TypeError("Array_to_string takes an Array of char") + return array.cast("string", max_length = array.vol.count, errors = errors)