mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-08-25 23:52:23 +02:00
Merge pull request #5 from npetroni/binary-format-hint
added Bin() to format_hints: print the value as a Python binary number
This commit is contained in:
@@ -5,6 +5,9 @@ These hints allow a plugin to indicate how they'd like a particular column's dat
|
||||
Text renderers should attempt to honour all hints provided in this module where possible
|
||||
"""
|
||||
|
||||
class Bin(int):
|
||||
"""A class to indicate that the integer value should be represented as a binary value"""
|
||||
|
||||
|
||||
class Hex(int):
|
||||
"""A class to indicate that the integer value should be represented as a hexidecimal value"""
|
||||
|
||||
@@ -25,7 +25,8 @@ def hex_bytes_as_text(value):
|
||||
|
||||
|
||||
class QuickTextRenderer(interfaces.renderers.Renderer):
|
||||
type_renderers = {format_hints.Hex: lambda x: "{:x}".format(x),
|
||||
type_renderers = {format_hints.Bin: lambda x: "{:b}".format(x),
|
||||
format_hints.Hex: lambda x: "{:x}".format(x),
|
||||
format_hints.HexBytes: hex_bytes_as_text,
|
||||
bytes: lambda x: x.decode("utf-8"),
|
||||
'default': lambda x: "{}".format(x)}
|
||||
|
||||
Reference in New Issue
Block a user