Move module gathering into generator

This commit is contained in:
Andrew Case
2020-04-08 18:17:34 +01:00
committed by ikelos
parent b42dfd614a
commit 719cd0d476
4 changed files with 16 additions and 21 deletions
@@ -28,11 +28,13 @@ class Check_syscall(plugins.PluginInterface):
requirements.PluginRequirement(name = 'lsmod', plugin = lsmod.Lsmod, version = (1, 0, 0))
]
def _generator(self, mods: Iterator[Any]):
def _generator(self):
mac.MacUtilities.aslr_mask_symbol_table(self.context, self.config['darwin'], self.config['primary'])
kernel = contexts.Module(self._context, self.config['darwin'], self.config['primary'], 0)
mods = lsmod.Lsmod.list_modules(self.context, self.config['primary'], self.config['darwin'])
handlers = mac.MacUtilities.generate_kernel_handler_info(self.context, self.config['primary'], kernel, mods)
nsysent = kernel.object_from_symbol(symbol_name = "nsysent")
@@ -59,8 +61,4 @@ class Check_syscall(plugins.PluginInterface):
def run(self):
return renderers.TreeGrid([("Table Address", format_hints.Hex), ("Table Name", str), ("Index", int),
("Handler Address", format_hints.Hex), ("Handler Module", str), ("Handler Symbol", str)],
self._generator(
lsmod.Lsmod.list_modules(self.context, self.config['primary'],
self.config['darwin'])))
self._generator())
@@ -111,11 +111,13 @@ class Check_sysctl(plugins.PluginInterface):
except exceptions.InvalidAddressException:
break
def _generator(self, mods: Iterator[Any]):
def _generator(self):
mac.MacUtilities.aslr_mask_symbol_table(self.context, self.config['darwin'], self.config['primary'])
kernel = contexts.Module(self._context, self.config['darwin'], self.config['primary'], 0)
mods = lsmod.Lsmod.list_modules(self.context, self.config['primary'], self.config['darwin'])
handlers = mac.MacUtilities.generate_kernel_handler_info(self.context, self.config['primary'], kernel, mods)
sysctl_list = kernel.object_from_symbol(symbol_name = "sysctl__children")
@@ -133,6 +135,4 @@ class Check_sysctl(plugins.PluginInterface):
def run(self):
return renderers.TreeGrid([("Name", str), ("Number", int), ("Perms", str), ("Handler Address", format_hints.Hex),
("Value", str), ("Handler Module", str), ("Handler Symbol", str)],
self._generator(
lsmod.Lsmod.list_modules(self.context, self.config['primary'],
self.config['darwin'])))
self._generator())
@@ -29,11 +29,13 @@ class Check_trap_table(plugins.PluginInterface):
requirements.PluginRequirement(name = 'lsmod', plugin = lsmod.Lsmod, version = (1, 0, 0))
]
def _generator(self, mods: Iterator[Any]):
def _generator(self):
mac.MacUtilities.aslr_mask_symbol_table(self.context, self.config['darwin'], self.config['primary'])
kernel = contexts.Module(self._context, self.config['darwin'], self.config['primary'], 0)
mods = lsmod.Lsmod.list_modules(self.context, self.config['primary'], self.config['darwin'])
handlers = mac.MacUtilities.generate_kernel_handler_info(self.context, self.config['primary'], kernel, mods)
table = kernel.object_from_symbol(symbol_name = "mach_trap_table")
@@ -54,11 +56,7 @@ class Check_trap_table(plugins.PluginInterface):
def run(self):
return renderers.TreeGrid([("Table Address", format_hints.Hex), ("Table Name", str), ("Index", int),
("Handler Address", format_hints.Hex), ("Handler Module", str), ("Handler Symbol", str)],
self._generator(
lsmod.Lsmod.list_modules(self.context, self.config['primary'],
self.config['darwin'])))
self._generator())
+4 -5
View File
@@ -30,11 +30,13 @@ class Timers(plugins.PluginInterface):
requirements.PluginRequirement(name = 'lsmod', plugin = lsmod.Lsmod, version = (1, 0, 0))
]
def _generator(self, mods: Iterator[Any]):
def _generator(self):
mac.MacUtilities.aslr_mask_symbol_table(self.context, self.config['darwin'], self.config['primary'])
kernel = contexts.Module(self.context, self.config['darwin'], self.config['primary'], 0)
mods = lsmod.Lsmod.list_modules(self.context, self.config['primary'], self.config['darwin'])
handlers = mac.MacUtilities.generate_kernel_handler_info(self.context, self.config['primary'], kernel, mods)
real_ncpus = kernel.object_from_symbol(symbol_name = "real_ncpus")
@@ -75,7 +77,4 @@ class Timers(plugins.PluginInterface):
def run(self):
return renderers.TreeGrid([("Function", format_hints.Hex), ("Param 0", format_hints.Hex), ("Param 1", format_hints.Hex),
("Deadline", int), ("Entry Time", int), ("Module", str), ("Symbol", str)],
self._generator(
lsmod.Lsmod.list_modules(self.context, self.config['primary'],
self.config['darwin'])))
self._generator())