From 60bf657895e04d27ff250dc792b4cffd3a74b0b1 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Sun, 25 Dec 2016 00:02:42 +0000 Subject: [PATCH] Allow pickling of FileLayers by unsetting the file (it'll be reopened as soon as a read happens). --- volatility/framework/layers/physical.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/volatility/framework/layers/physical.py b/volatility/framework/layers/physical.py index 7bac74b5c..d77250270 100644 --- a/volatility/framework/layers/physical.py +++ b/volatility/framework/layers/physical.py @@ -130,6 +130,14 @@ class FileLayer(interfaces.layers.DataLayerInterface): self._file.seek(offset) self._file.write(data) + def __getstate__(self): + """Do not store the open _file_ attribute, our property will ensure the file is open when needed + + This is necessary for multi-processing + """ + self._file_ = None + return self.__dict__ + def destroy(self): """Closes the file handle""" self._file.close()