mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-29 13:04:58 +02:00
Merge branch 'master' of github.com:volatilityfoundation/volatility3
This commit is contained in:
@@ -52,6 +52,14 @@ class DataLayerInterface(validity.ValidityRoutines, metaclass = ABCMeta):
|
||||
Note: Writes are not atomic, therefore some data can be written, even if an exception is thrown.
|
||||
"""
|
||||
|
||||
def destroy(self):
|
||||
"""Allows DataLayers to close any open handles, etc.
|
||||
|
||||
Systems that make use of Data Layers should called destroy when they are done with them.
|
||||
This will close all handles, and make the object unreadable
|
||||
(exceptions will be thrown using a DataLayer after destruction)"""
|
||||
pass
|
||||
|
||||
|
||||
class TranslationLayerInterface(DataLayerInterface, metaclass = ABCMeta):
|
||||
@abstractmethod
|
||||
|
||||
@@ -50,6 +50,7 @@ class Memory(validity.ValidityRoutines):
|
||||
if depend_list:
|
||||
raise exceptions.LayerException("Layer " + layer.name +
|
||||
" is depended upon by " + ", ".join(depend_list))
|
||||
self._layers[name].destroy()
|
||||
del self._layers[name]
|
||||
|
||||
def __getitem__(self, name):
|
||||
|
||||
@@ -93,3 +93,7 @@ class FileLayer(interfaces.layers.DataLayerInterface):
|
||||
raise exceptions.InvalidAddressException("Data segment outside of the " + self.name + " file boundaries")
|
||||
self._file.seek(offset)
|
||||
self._file.write(data)
|
||||
|
||||
def destroy(self):
|
||||
"""Closes the file handle"""
|
||||
self._file.close()
|
||||
|
||||
Reference in New Issue
Block a user