builtin_constraints() returns all constraints by default

This commit is contained in:
Michael Ligh
2019-02-07 09:08:32 +00:00
committed by ikelos
parent f34cd01b09
commit 12fe297c80
2 changed files with 13 additions and 11 deletions
@@ -141,13 +141,7 @@ class PoolScanner(plugins.PluginInterface):
def _generator(self):
symbol_table = self.config["nt_symbols"]
constraints = self.builtin_constraints(symbol_table, [
b'AtmT',
b'Pro\xe3',
b'Proc',
b'Fil\xe5',
b'File',
])
constraints = self.builtin_constraints(symbol_table)
for constraint, mem_object, header in self.generate_pool_scan(self.context,
self.config["primary"],
@@ -169,8 +163,13 @@ class PoolScanner(plugins.PluginInterface):
yield (0, (constraint.type_name, format_hints.Hex(header.vol.offset), header.vol.layer_name, name))
@staticmethod
def builtin_constraints(symbol_table: str, tags: List[bytes]) -> List[PoolConstraint]:
"""Get built-in PoolConstraints given a list of pool tags"""
def builtin_constraints(symbol_table: str, tags_filter: List[bytes] = []) -> List[PoolConstraint]:
"""Get built-in PoolConstraints given a list of pool tags.
The tags_filter is a list of pool tags, and the associated
PoolConstraints are returned. If tags_filter is empty or
not supplied, then all builtin constraints are returned.
"""
builtins = [
# atom tables
@@ -209,7 +208,10 @@ class PoolScanner(plugins.PluginInterface):
page_type = PoolType.PAGED | PoolType.NONPAGED | PoolType.FREE),
]
return [constraint for constraint in builtins if constraint.tag in tags]
if not tags_filter:
return builtins
return [constraint for constraint in builtins if constraint.tag in tags_filter]
@classmethod
def generate_pool_scan(cls,
@@ -48,7 +48,7 @@ class PsScan(plugins.PluginInterface, timeliner.TimeLinerInterface):
"""Scans for processes using the poolscanner module and constraints"""
constraints = poolscanner.PoolScanner.builtin_constraints(symbol_table,
[b'Pro\xe3', b'Proc',])
[b'Pro\xe3', b'Proc'])
for result in poolscanner.PoolScanner.generate_pool_scan(context,
layer_name,