mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-08 02:37:39 +02:00
Allow VolTemplateProxies to include additional useful methods.
This commit is contained in:
@@ -413,7 +413,6 @@ class Enumeration(interfaces.objects.ObjectInterface, int):
|
||||
self._vol['base_type'] = base_type
|
||||
|
||||
@classmethod
|
||||
@functools.lru_cache(maxsize = 128)
|
||||
def _generate_inverse_choices(cls, choices: Dict[str, int]) -> Dict[int, str]:
|
||||
"""Generates the inverse choices for the object"""
|
||||
inverse_choices = {} # type: Dict[int, str]
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
|
||||
# specific language governing rights and limitations under the License.
|
||||
#
|
||||
|
||||
import functools
|
||||
import logging
|
||||
from typing import Any, ClassVar, Dict, List, Type
|
||||
|
||||
@@ -41,6 +41,12 @@ class ObjectTemplate(interfaces.objects.Template):
|
||||
super().__init__(type_name = type_name, **arguments)
|
||||
self._arguments['object_class'] = object_class
|
||||
|
||||
proxy_cls = self.vol.object_class.VolTemplateProxy
|
||||
for method_name in dir(proxy_cls):
|
||||
if (method_name not in dir(interfaces.objects.ObjectInterface.VolTemplateProxy)
|
||||
and callable(getattr(proxy_cls, method_name)) and not method_name.startswith('_')):
|
||||
setattr(self, method_name, functools.partial(getattr(proxy_cls, method_name), self))
|
||||
|
||||
@property
|
||||
def size(self) -> int:
|
||||
"""Returns the children of the templated object (see :class:`~volatility.framework.interfaces.objects.ObjectInterface.VolTemplateProxy`)"""
|
||||
|
||||
Reference in New Issue
Block a user