mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-06 17:57:38 +02:00
Add in requirement checking to plugins.
This commit is contained in:
@@ -37,6 +37,7 @@ class ListRequirement(GenericRequirement):
|
||||
self.max_elements = max_elements
|
||||
|
||||
def check_value(self, value, context):
|
||||
"""Check the types on each of the returned values and then call the element type's check for each one"""
|
||||
self._type_check(value, list)
|
||||
if not all([self._type_check(element, self.element_type) for element in value]):
|
||||
raise TypeError("At least one element in the list is not of the correct type.")
|
||||
|
||||
@@ -34,11 +34,12 @@ class PluginInterface(validity.ValidityRoutines, metaclass = ABCMeta):
|
||||
|
||||
@abstractmethod
|
||||
def requirements(self):
|
||||
"""Returns a ConfigGroup object to contain the required options"""
|
||||
"""Returns a list of requirements options"""
|
||||
pass
|
||||
|
||||
def check_requirements(self):
|
||||
pass
|
||||
for requirement in self.requirements():
|
||||
requirement.check_value(requirement.value, self._context)
|
||||
|
||||
@abstractmethod
|
||||
def __call__(self, context):
|
||||
|
||||
Reference in New Issue
Block a user