mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-06 17:57:38 +02:00
Convert the private file attribute to a property to allow for cloning.
This commit is contained in:
@@ -66,10 +66,18 @@ class FileLayer(interfaces.layers.DataLayerInterface):
|
||||
def __init__(self, context, config_path, name, filename):
|
||||
super().__init__(context, config_path, name)
|
||||
|
||||
self._filename = filename
|
||||
self._file_ = None
|
||||
self._size = os.path.getsize(filename)
|
||||
|
||||
@property
|
||||
def _file(self):
|
||||
"""Property to prevent the intializer storing an unserializable open file (for context cloning)"""
|
||||
# FIXME: Add "+" to the mode once we've determined whether write mode is enabled
|
||||
mode = "rb"
|
||||
self._file = open(filename, mode)
|
||||
self._size = os.path.getsize(filename)
|
||||
if not self._file_:
|
||||
self._file_ = open(self._filename, mode)
|
||||
return self._file_
|
||||
|
||||
@property
|
||||
def maximum_address(self):
|
||||
|
||||
Reference in New Issue
Block a user