From 95238f7f01f6fb3644cac221c28d9b20ba85b587 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Sun, 4 Jan 2015 04:55:17 +0000 Subject: [PATCH] Eradicate **magic where possible and rename where appropriate. --- volatility/framework/interfaces/objects.py | 10 +++++----- volatility/framework/objects/templates.py | 20 ++++++++++---------- volatility/plugins/windows/pslist.py | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/volatility/framework/interfaces/objects.py b/volatility/framework/interfaces/objects.py index 017954f5d..8067afaf5 100644 --- a/volatility/framework/interfaces/objects.py +++ b/volatility/framework/interfaces/objects.py @@ -112,19 +112,19 @@ class Template(validity.ValidityRoutines): This is effectively a class for currying object calls """ - def __init__(self, structure_name, **kwargs): + def __init__(self, structure_name, **arguments): """Stores the keyword arguments for later use""" # Allow the updating of template arguments whilst still in template form - self._volinfo = collections.ChainMap(kwargs, {'structure_name': structure_name}) + self._volinfo = collections.ChainMap(arguments, {'structure_name': structure_name}) @property def volinfo(self): """Returns a volatility information object, much like the ObjectInterface provides""" - return ReadOnlyInformation(self._volinfo) + return ReadOnlyMapping(self._volinfo) - def update_volinfo(self, **newargs): + def update_volinfo(self, **new_arguments): """Updates the keyword arguments""" - self._volinfo.update(newargs) + self._volinfo.update(new_arguments) def __call__(self, context, object_info): """Constructs the object diff --git a/volatility/framework/objects/templates.py b/volatility/framework/objects/templates.py index 59da492fb..d9ca07fd5 100644 --- a/volatility/framework/objects/templates.py +++ b/volatility/framework/objects/templates.py @@ -17,19 +17,19 @@ class ObjectTemplate(interfaces.objects.Template, validity.ValidityRoutines): etc. """ - def __init__(self, object_class = None, structure_name = None, **kwargs): + def __init__(self, object_class = None, structure_name = None, **arguments): interfaces.objects.Template.__init__(self, structure_name = structure_name, - **kwargs) + **arguments) self._class_check(object_class, interfaces.objects.ObjectInterface) self.update_volinfo(object_class = object_class) @classmethod - def template_children(cls, **kwargs): + def template_children(cls): raise NotImplementedError("Abstract method template_children not implemented yet.") @classmethod - def template_size(cls, **kwargs): + def template_size(cls): raise NotImplementedError("Abstract method template_size not implemented yet.") @property @@ -66,12 +66,12 @@ class ObjectTemplate(interfaces.objects.Template, validity.ValidityRoutines): """ # We always use the template size (as calculated by the object class) # over the one passed in by an argument - kwargs = {} - kwargs.update(self.volinfo) - del kwargs['object_class'] + arguments = {} + arguments.update(self.volinfo) + del arguments['object_class'] return self.volinfo.object_class(context = context, object_info = object_info, - **kwargs) + **arguments) class ReferenceTemplate(interfaces.objects.Template): @@ -80,6 +80,6 @@ class ReferenceTemplate(interfaces.objects.Template): It should not return any attributes """ - def __call__(self, context, object_info, **kwargs): + def __call__(self, context, object_info, **arguments): template = context.symbol_space.get_structure(self.volinfo.structure_name) - return template(context = context, object_info = object_info, **kwargs) + return template(context = context, object_info = object_info, **arguments) diff --git a/volatility/plugins/windows/pslist.py b/volatility/plugins/windows/pslist.py index 102511a7d..e4ee523e9 100644 --- a/volatility/plugins/windows/pslist.py +++ b/volatility/plugins/windows/pslist.py @@ -21,7 +21,7 @@ class pslist(plugins.PluginInterface): # Get the process from the thread object in kernel space return ethread.owning_process() - def __call__(self, ctx, **kwargs): + def __call__(self, ctx): print(repr(self.kernel_process_from_physical_process(ctx, 'intel', 0x192ad18)))