mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-08-28 10:49:42 +02:00
Core: Add in framework version check for plugins
This commit is contained in:
@@ -13,7 +13,7 @@ import logging
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import List, Optional, Tuple
|
||||
|
||||
from volatility import classproperty
|
||||
from volatility import classproperty, framework
|
||||
from volatility.framework import exceptions, constants, interfaces
|
||||
|
||||
vollog = logging.getLogger(__name__)
|
||||
@@ -78,6 +78,7 @@ class PluginInterface(interfaces.configuration.ConfigurableInterface, metaclass
|
||||
|
||||
# Be careful with inheritance around this
|
||||
_version = (0, 0, 0) # type: Tuple[int, int, int]
|
||||
_required_framework_verison = (1, 0, 0) # type: Tuple[int, int, int]
|
||||
"""The _version variable is a quick way for plugins to define their current interface, it should follow SemVer rules"""
|
||||
|
||||
def __init__(self,
|
||||
@@ -100,6 +101,8 @@ class PluginInterface(interfaces.configuration.ConfigurableInterface, metaclass
|
||||
raise exceptions.PluginRequirementException("The plugin configuration failed to validate")
|
||||
self._file_consumer = None # type: Optional[FileConsumerInterface]
|
||||
|
||||
framework.require_interface_version(*self._required_framework_verison)
|
||||
|
||||
def set_file_consumer(self, consumer: FileConsumerInterface) -> None:
|
||||
"""Sets the file consumer to be used by this plugin."""
|
||||
self._file_consumer = consumer
|
||||
|
||||
Reference in New Issue
Block a user