From a382916593e512b53f3a146db74fe4daaacfe657 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Mon, 19 Jan 2015 11:02:01 +0000 Subject: [PATCH] Add in reading optimization. --- volatility/framework/interfaces/layers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/volatility/framework/interfaces/layers.py b/volatility/framework/interfaces/layers.py index ff73eb448..31e43ad66 100644 --- a/volatility/framework/interfaces/layers.py +++ b/volatility/framework/interfaces/layers.py @@ -77,19 +77,19 @@ class TranslationLayerInterface(DataLayerInterface, metaclass = ABCMeta): def read(self, offset, length, pad = False): """Reads an offset for length bytes and returns 'bytes' (not 'str') of length size""" current_offset = offset - output = b"" + output = [] for (offset, mapped_offset, length, layer) in self.mapping(offset, length): if not pad and offset > current_offset: raise exceptions.InvalidAddressException("Layer " + self.name + " cannot map offset " + str(current_offset)) elif offset > current_offset: - output += b"\x00" * (current_offset - offset) + output += [b"\x00" * (current_offset - offset)] current_offset = offset elif offset < current_offset: raise exceptions.LayerException("Mapping returned an overlapping element") - output += self._context.memory.read(layer, mapped_offset, length, pad) + output += [self._context.memory.read(layer, mapped_offset, length, pad)] current_offset += length - return output + return "".join(output) def write(self, offset, value): """Writes a value at offset, distributing the writing across any underlying mapping"""