diff --git a/volatility/framework/renderers/format_hints.py b/volatility/framework/renderers/format_hints.py new file mode 100644 index 000000000..e01b227b1 --- /dev/null +++ b/volatility/framework/renderers/format_hints.py @@ -0,0 +1,10 @@ +"""The official list of format hints that text renderers and plugins can rely upon existing within the framework + +These hints allow a plugin to indicate how they'd like a particular column's data to be represented. + +Text renderers should attempt to honour all hints provided in this module where possible +""" + + +class Hex(int): + """A class to indicate that the integer value should be represented as a hexidecimal value""" diff --git a/volatility/framework/renderers/text.py b/volatility/framework/renderers/text.py index 56b13b923..10ea028b9 100644 --- a/volatility/framework/renderers/text.py +++ b/volatility/framework/renderers/text.py @@ -1,6 +1,7 @@ import sys from volatility.framework import interfaces +from volatility.framework.renderers import format_hints class TextRenderer(interfaces.renderers.Renderer): @@ -21,7 +22,10 @@ class TextRenderer(interfaces.renderers.Renderer): def visitor(node, accumulator): for column in grid.columns: - accumulator.write("\t{}".format(node.values[column.index])) + text_format = "\t{}" + if column.type == format_hints.Hex: + text_format = "\t{:x}" + accumulator.write(text_format.format(node.values[column.index])) accumulator.write("\n") return accumulator