mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-22 01:24:51 +02:00
Introduce format hints for renderers.
This commit is contained in:
@@ -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"""
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user