Skip to content
Merged
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
51 changes: 34 additions & 17 deletions volatility3/cli/volshell/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def _display_simple_type(
],
include_value: bool = True,
) -> str:
# build the display_type_string based on the aviable information
# build the display_type_string based on the available information

if hasattr(volobject.vol, "size"):
# the most common type to display, this shows their full size, e.g.:
Expand Down Expand Up @@ -587,26 +587,43 @@ def _display_simple_type(

def _display_value(self, value: Any) -> str:
try:
# if value is a BaseAbsentValue they display N/A
if isinstance(value, interfaces.renderers.BaseAbsentValue):
return "N/A"
elif isinstance(value, objects.Pointer):
# show pointers in hex to match output for struct addrs
# highlight null or unreadable pointers
if value == 0:
suffix = " (null pointer)"
elif not value.is_readable():
suffix = " (unreadable pointer)"
else:
suffix = ""
return f"{hex(value)}{suffix}"
elif isinstance(value, objects.PrimitiveObject):
return repr(value)
elif isinstance(value, objects.Array):
return repr([self._display_value(val) for val in value])
else:
return hex(value.vol.offset)
# volobject branch
if isinstance(
value,
Union[
interfaces.objects.ObjectInterface, interfaces.objects.Template
],
):
if isinstance(value, objects.Pointer):
# show pointers in hex to match output for struct addrs
# highlight null or unreadable pointers
if value == 0:
suffix = " (null pointer)"
elif not value.is_readable():
suffix = " (unreadable pointer)"
else:
suffix = ""
return f"{hex(value)}{suffix}"
elif isinstance(value, objects.PrimitiveObject):
return repr(value)
elif isinstance(value, objects.Array):
return repr([self._display_value(val) for val in value])
else:
return hex(value.vol.offset)
else:
# non volobject
if value is None:
return "N/A"
else:
return value

except exceptions.InvalidAddressException:
return "-"
# if value causes an InvalidAddressException like BaseAbsentValue then display N/A
return "N/A"

def generate_treegrid(
self, plugin: Type[interfaces.plugins.PluginInterface], **kwargs
Expand Down
Loading