diff options
| author | Peter LaFosse <peter@vector35.com> | 2017-01-05 09:14:31 -0500 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2017-01-05 09:14:31 -0500 |
| commit | 4761ea9c83104b872d8d49fcde45f17d17e7872d (patch) | |
| tree | 0acca0d74701a834c36f85aebd7dd9955ecbfb8f /python/plugin.py | |
| parent | 96acbed85902d8dfd43ef624afac72145ae6e577 (diff) | |
Modifying how enumerations are exposed and used, and a bunch of cleanup of existing plugins
Diffstat (limited to 'python/plugin.py')
| -rw-r--r-- | python/plugin.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/python/plugin.py b/python/plugin.py index b6faef7f..9a4da487 100644 --- a/python/plugin.py +++ b/python/plugin.py @@ -24,6 +24,7 @@ import threading # Binary Ninja components import _binaryninjacore as core +from enums import LowLevelILOperation import startup import filemetadata import binaryview @@ -77,7 +78,7 @@ class PluginCommand(object): ctypes.memmove(ctypes.byref(self.command), ctypes.byref(cmd), ctypes.sizeof(core.BNPluginCommand)) self.name = str(cmd.name) self.description = str(cmd.description) - self.type = core.BNPluginCommandType(cmd.type) + self.type = LowLevelILOperation(cmd.type) @classmethod def _default_action(cls, view, action): @@ -209,21 +210,21 @@ class PluginCommand(object): def is_valid(self, context): if context.view is None: return False - if self.command.type == core.BNPluginCommandType.DefaultPluginCommand: + if self.command.type == LowLevelILOperation.DefaultPluginCommand: if not self.command.defaultIsValid: return True return self.command.defaultIsValid(self.command.context, context.view.handle) - elif self.command.type == core.BNPluginCommandType.AddressPluginCommand: + elif self.command.type == LowLevelILOperation.AddressPluginCommand: if not self.command.addressIsValid: return True return self.command.addressIsValid(self.command.context, context.view.handle, context.address) - elif self.command.type == core.BNPluginCommandType.RangePluginCommand: + elif self.command.type == LowLevelILOperation.RangePluginCommand: if context.length == 0: return False if not self.command.rangeIsValid: return True return self.command.rangeIsValid(self.command.context, context.view.handle, context.address, context.length) - elif self.command.type == core.BNPluginCommandType.FunctionPluginCommand: + elif self.command.type == LowLevelILOperation.FunctionPluginCommand: if context.function is None: return False if not self.command.functionIsValid: @@ -234,13 +235,13 @@ class PluginCommand(object): def execute(self, context): if not self.is_valid(context): return - if self.command.type == core.BNPluginCommandType.DefaultPluginCommand: + if self.command.type == LowLevelILOperation.DefaultPluginCommand: self.command.defaultCommand(self.command.context, context.view.handle) - elif self.command.type == core.BNPluginCommandType.AddressPluginCommand: + elif self.command.type == LowLevelILOperation.AddressPluginCommand: self.command.addressCommand(self.command.context, context.view.handle, context.address) - elif self.command.type == core.BNPluginCommandType.RangePluginCommand: + elif self.command.type == LowLevelILOperation.RangePluginCommand: self.command.rangeCommand(self.command.context, context.view.handle, context.address, context.length) - elif self.command.type == core.BNPluginCommandType.FunctionPluginCommand: + elif self.command.type == LowLevelILOperation.FunctionPluginCommand: self.command.functionCommand(self.command.context, context.view.handle, context.function.handle) def __repr__(self): |
