Convert all remaining plugins to use the new classmethod pslist.

This commit is contained in:
Mike Auty
2018-06-16 13:38:48 +01:00
parent 6ca34e6607
commit ac8401991c
13 changed files with 89 additions and 55 deletions
+3 -3
View File
@@ -54,8 +54,6 @@ class Maps(plugins.PluginInterface):
))
def run(self):
plugin = pslist.PsList(self.context, self.config_path)
return renderers.TreeGrid(
[("PID", int),
("Process", str),
@@ -67,4 +65,6 @@ class Maps(plugins.PluginInterface):
("Minor", int),
("Inode", int),
("File Path", str)],
self._generator(plugin.list_tasks()))
self._generator(pslist.PsList.list_tasks(self.context,
self.config['primary'],
self.config['vmlinux'])))
+5 -4
View File
@@ -25,13 +25,14 @@ class PsList(interfaces_plugins.PluginInterface):
name = utility.array_to_string(task.comm)
yield (0, (pid, ppid, name))
def list_tasks(self):
@classmethod
def list_tasks(cls, context, primary_layer: str, vmlinux_table: str):
"""Lists all the tasks in the primary layer"""
layer_name = self.context.memory[self.config['primary']].config['memory_layer']
layer_name = context.memory[primary_layer].config['memory_layer']
_, aslr_shift = linux.LinuxUtilities.find_aslr(self.context, self.config["vmlinux"], layer_name)
vmlinux = self.context.module(self.config["vmlinux"], self.config["primary"], aslr_shift)
_, aslr_shift = linux.LinuxUtilities.find_aslr(context, vmlinux_table, layer_name)
vmlinux = context.module(vmlinux_table, primary_layer, aslr_shift)
init_task = vmlinux.object(symbol_name = "init_task")
for task in init_task.tasks: