From d9ed86bcc56badd45a62a970cf13af93e55c2937 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Sat, 16 Jun 2018 14:29:51 +0100 Subject: [PATCH] Ensure we return the correct values for dir(). --- volatility/framework/objects/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/volatility/framework/objects/__init__.py b/volatility/framework/objects/__init__.py index 894e534e6..7ea25eed4 100644 --- a/volatility/framework/objects/__init__.py +++ b/volatility/framework/objects/__init__.py @@ -633,6 +633,10 @@ class Struct(interfaces.objects.ObjectInterface): return member raise AttributeError("Struct has no attribute: {}.{}".format(self.vol.type_name, attr)) + def __dir__(self) -> typing.Iterable[str]: + """Returns a complete list of members when dir is called""" + return list(super().__dir__()) + list(self.vol.members.keys()) + def write(self, value): raise TypeError("Structs cannot be written to directly, individual members must be written instead")