mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-10 11:47:38 +02:00
Expose the sanitize method, since it's necessary for accessing columns.
This commit is contained in:
@@ -127,6 +127,11 @@ class TreeGrid(object, metaclass = ABCMeta):
|
||||
:param generator: A generator that populates the tree/grid structure
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
@abstractmethod
|
||||
def sanitize_name(text: str) -> str:
|
||||
"""Method used to sanitize column names for TreeNodes"""
|
||||
|
||||
@abstractmethod
|
||||
def populate(self,
|
||||
func: VisitorSignature = None,
|
||||
|
||||
@@ -150,7 +150,7 @@ class TreeGrid(interfaces.renderers.TreeGrid):
|
||||
"Column {}'s type is not a simple type: {}".format(name, column_type.__class__.__name__))
|
||||
converted_columns.append(interfaces.renderers.Column(len(converted_columns), name, column_type))
|
||||
self.RowStructure = collections.namedtuple("RowStructure",
|
||||
[self._sanitize(column.name) for column in converted_columns])
|
||||
[self.sanitize_name(column.name) for column in converted_columns])
|
||||
self._columns = converted_columns
|
||||
if generator is None:
|
||||
generator = []
|
||||
@@ -159,11 +159,11 @@ class TreeGrid(interfaces.renderers.TreeGrid):
|
||||
self._generator = generator
|
||||
|
||||
@staticmethod
|
||||
def _sanitize(text: str) -> str:
|
||||
def sanitize_name(text: str) -> str:
|
||||
output = ""
|
||||
for letter in text.lower():
|
||||
if letter != ' ':
|
||||
output += (letter if letter in 'abcdefghiljklmnopqrstuvwxyz_' else '_')
|
||||
output += (letter if letter in 'abcdefghiljklmnopqrstuvwxyz_0123456789' else '_')
|
||||
return output
|
||||
|
||||
def populate(self,
|
||||
|
||||
Reference in New Issue
Block a user