Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk out Module support for specific requirements #1118

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions volatility3/framework/contexts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from typing import Callable, Iterable, List, Optional, Set, Tuple, Union

from volatility3.framework import constants, interfaces, symbols, exceptions
from volatility3.framework.configuration import requirements
from volatility3.framework.objects import templates

vollog = logging.getLogger(__name__)
Expand Down Expand Up @@ -226,6 +227,20 @@ def create(
# Add the module to the context modules collection
return return_val

@classmethod
def get_requirements(cls) -> List[interfaces.configuration.RequirementInterface]:
"""Returns a list of Requirement objects for this type of layer."""
return [
requirements.IntRequirement(name="offset", optional=False),
requirements.TranslationLayerRequirement(name="layer_name", optional=False),
requirements.TranslationLayerRequirement(
name="native_layer_name", optional=True
),
requirements.SymbolTableRequirement(
name="symbol_table_name", optional=False
),
]

def object(
self,
object_type: str,
Expand Down
5 changes: 4 additions & 1 deletion volatility3/framework/interfaces/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ def __init__(self, context: ContextInterface, config_path: str, name: str) -> No
super().__init__(context, config_path)
self._module_name = name

@classmethod
def get_requirements(cls) -> List[interfaces.configuration.RequirementInterface]:
"""Returns a list of Requirement objects for this type of layer."""

@property
def _layer_name(self) -> str:
return self.config["layer_name"]
Expand All @@ -175,7 +179,6 @@ def _symbol_table_name(self) -> str:

def build_configuration(self) -> "interfaces.configuration.HierarchicalDict":
"""Builds the configuration dictionary for this specific Module"""

config = super().build_configuration()

config["offset"] = self.config["offset"]
Expand Down
Loading