mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-09 11:17:38 +02:00
Refactor the names given the new deprecation.
The concept is to have a helper_ namespace, to ensure that members cannot accidentally be overriden by properties in extended classes. This demonstrates that by renaming all extension properties to helper_<name>.
This commit is contained in:
@@ -15,14 +15,14 @@ class _ETHREAD(objects.Struct):
|
||||
|
||||
class _CMHIVE(objects.Struct):
|
||||
@property
|
||||
def name(self):
|
||||
def helper_name(self):
|
||||
"""Determine a name for the hive. Note that some attributes are
|
||||
unpredictably blank across different OS versions while others are populated,
|
||||
so we check all possibilities and take the first one that's not empty"""
|
||||
|
||||
for attr in ["FileFullPath", "FileUserName", "HiveRootPath"]:
|
||||
try:
|
||||
return getattr(self, attr).String
|
||||
return getattr(self, attr).helper_string
|
||||
except (AttributeError, exceptions.InvalidAddressException):
|
||||
pass
|
||||
|
||||
@@ -31,7 +31,7 @@ class _CMHIVE(objects.Struct):
|
||||
|
||||
class _UNICODE_STRING(objects.Struct):
|
||||
@property
|
||||
def String(self):
|
||||
def helper_string(self):
|
||||
# We explicitly do *not* catch errors here, we allow an exception to be thrown
|
||||
# (otherwise there's no way to determine anything went wrong)
|
||||
# It's up to the user of this method to catch exceptions
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import volatility.framework.interfaces.plugins as interfaces_plugins
|
||||
from volatility.plugins.windows import pslist
|
||||
from volatility.framework import exceptions, renderers
|
||||
from volatility.framework.renderers import format_hints
|
||||
from volatility.plugins.windows import pslist
|
||||
|
||||
|
||||
class DllList(interfaces_plugins.PluginInterface):
|
||||
@@ -20,9 +20,9 @@ class DllList(interfaces_plugins.PluginInterface):
|
||||
|
||||
BaseDllName = FullDllName = ""
|
||||
try:
|
||||
BaseDllName = entry.BaseDllName.String
|
||||
BaseDllName = entry.BaseDllName.helper_string
|
||||
# We assume that if the BaseDllName points to an invalid buffer, so will FullDllName
|
||||
FullDllName = entry.FullDllName.String
|
||||
FullDllName = entry.FullDllName.helper_string
|
||||
except exceptions.InvalidAddressException:
|
||||
pass
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class HiveList(plugins.PluginInterface):
|
||||
for hive in self.list_hives():
|
||||
|
||||
yield (0, (format_hints.Hex(hive.vol.offset),
|
||||
hive.name or ""))
|
||||
hive.helper_name or ""))
|
||||
|
||||
def list_hives(self):
|
||||
"""Lists all the hives in the primary layer"""
|
||||
|
||||
@@ -22,12 +22,12 @@ class Modules(plugins.PluginInterface):
|
||||
for mod in self.list_modules():
|
||||
|
||||
try:
|
||||
BaseDllName = mod.BaseDllName.String
|
||||
BaseDllName = mod.BaseDllName.helper_string
|
||||
except exceptions.InvalidAddressException:
|
||||
BaseDllName = ""
|
||||
|
||||
try:
|
||||
FullDllName = mod.FullDllName.String
|
||||
FullDllName = mod.FullDllName.helper_string
|
||||
except exceptions.InvalidAddressException:
|
||||
FullDllName = ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user