Class |
Description |
|---|---|
The |
|
The |
|
The |
|
The |
Bases: object
The BackgroundTask class provides a mechanism for reporting progress of
an optionally cancelable task to the user via the status bar in the UI.
If can_cancel is is True, then the task can be cancelled either
programmatically (via cancel) or by the user via the UI.
Note this class does not provide a means to execute a task, which is
available via the BackgroundTaskThread class.
initial_progress_text – text description of the task to display in the status bar in the UI, defaults to “”
can_cancel – whether to enable cancellation of the task, defaults to False
Whether the task can be cancelled (read-only)
Whether the task has been cancelled
Whether the task has finished
Text description of the progress of the background task (displayed in status bar of the UI)
Bases: BackgroundTask
The BackgroundTaskThread class provides an all-in-one solution for executing a BackgroundTask
in a thread.
See the BackgroundTask for additional information.
initial_progress_text – text description of the task to display in the status bar in the UI, defaults to “”
can_cancel – whether to enable cancellation of the task, defaults to False
Bases: object
The class PluginCommand contains all the plugin registration methods as class methods.
You shouldn’t need to create an instance of this class, instead see register, register_for_address, register_for_function, and similar class methods for examples on how to register your plugin.
execute Execute a plugin. See the example in PluginCommandContext
context (str) – PluginCommandContext to pass the PluginCommand
None
>>> ctx = PluginCommandContext(bv);
>>> PluginCommand.get_valid_list(ctx)[r'PDB\Load'].execute(ctx)
Dict of registered plugins
context (PluginCommandContext) –
context (PluginCommandContext) –
register Register a plugin
name (str) – name of the plugin (use ‘Folder\Name’ to have the menu item nested in a folder)
description (str) – description of the plugin
action (callback) – function to call with the BinaryView as an argument
is_valid (callback) – optional argument of a function passed a BinaryView to determine whether the plugin should be enabled for that view
None
>>> def my_plugin(bv: BinaryView):
>>> log_info(f"My plugin was called on bv: `{bv}`")
>>> PluginCommand.register("My Plugin", "My plugin description (not used)", my_plugin)
True
>>> def is_valid(bv: BinaryView) -> bool:
>>> return False
>>> PluginCommand.register("My Plugin (With Valid Function)", "My plugin description (not used)", my_plugin, is_valid)
True
Warning
Calling register with the same function name will replace the existing function but will leak the memory of the original plugin.
register_for_address Register a plugin to be called with an address argument
name (str) – name of the plugin (use ‘Folder\Name’ to have the menu item nested in a folder)
description (str) – description of the plugin
action (callback) – function to call with the BinaryView and address as arguments
is_valid (callback) – optional argument of a function passed a BinaryView and address to determine whether the plugin should be enabled for that view
None
>>> def my_plugin(bv: BinaryView, address: int):
>>> log_info(f"My plugin was called on bv: `{bv}` at address {hex(address)}")
>>> PluginCommand.register_for_address("My Plugin", "My plugin description (not used)", my_plugin)
True
>>> def is_valid(bv: BinaryView, address: int) -> bool:
>>> return False
>>> PluginCommand.register_for_address("My Plugin (With Valid Function)", "My plugin description (not used)", my_plugin, is_valid)
True
Warning
Calling register_for_address with the same function name will replace the existing function but will leak the memory of the original plugin.
register_for_function Register a plugin to be called with a function argument
name (str) – name of the plugin (use ‘Folder\Name’ to have the menu item nested in a folder)
description (str) – description of the plugin
action (callback) – function to call with the BinaryView and a Function as arguments
is_valid (callback) – optional argument of a function passed a BinaryView and Function to determine whether the plugin should be enabled for that view
None
>>> def my_plugin(bv: BinaryView, func: Function):
>>> log_info(f"My plugin was called on func {func} in bv `{bv}`")
>>> PluginCommand.register_for_function("My Plugin", "My plugin description (not used)", my_plugin)
True
>>> def is_valid(bv: BinaryView, func: Function) -> bool:
>>> return False
>>> PluginCommand.register_for_function("My Plugin (With Valid Function)", "My plugin description (not used)", my_plugin, is_valid)
True
Warning
Calling register_for_function with the same function name will replace the existing function but will leak the memory of the original plugin.
register_for_high_level_il_function Register a plugin to be called with a high level IL function argument
name (str) – name of the plugin (use ‘Folder\Name’ to have the menu item nested in a folder)
description (str) – description of the plugin
action (callback) – function to call with the BinaryView and a HighLevelILFunction as arguments
is_valid (callback) – optional argument of a function passed a BinaryView and HighLevelILFunction to determine whether the plugin should be enabled for that view
None
>>> def my_plugin(bv: BinaryView, func: HighLevelILFunction):
>>> log_info(f"My plugin was called on func {func} in bv `{bv}`")
>>> PluginCommand.register_for_high_level_il_function("My Plugin", "My plugin description (not used)", my_plugin)
True
>>> def is_valid(bv: BinaryView, func: HighLevelILFunction) -> bool:
>>> return False
>>> PluginCommand.register_for_high_level_il_function("My Plugin (With Valid Function)", "My plugin description (not used)", my_plugin, is_valid)
True
Warning
Calling register_for_high_level_il_function with the same function name will replace the existing function but will leak the memory of the original plugin.
register_for_high_level_il_instruction Register a plugin to be called with a high level IL instruction argument
name (str) – name of the plugin (use ‘Folder\Name’ to have the menu item nested in a folder)
description (str) – description of the plugin
action (callback) – function to call with the BinaryView and a HighLevelILInstruction as arguments
is_valid (callback) – optional argument of a function passed a BinaryView and HighLevelILInstruction to determine whether the plugin should be enabled for that view
None
>>> def my_plugin(bv: BinaryView, inst: HighLevelILInstruction):
>>> log_info(f"My plugin was called on inst {inst} in bv `{bv}`")
>>> PluginCommand.register_for_high_level_il_instruction("My Plugin", "My plugin description (not used)", my_plugin)
True
>>> def is_valid(bv: BinaryView, inst: HighLevelILInstruction) -> bool:
>>> return False
>>> PluginCommand.register_for_high_level_il_instruction("My Plugin (With Valid Function)", "My plugin description (not used)", my_plugin, is_valid)
True
Warning
Calling register_for_high_level_il_instruction with the same function name will replace the existing function but will leak the memory of the original plugin.
register_for_low_level_il_function Register a plugin to be called with a low level IL function argument
name (str) – name of the plugin (use ‘Folder\Name’ to have the menu item nested in a folder)
description (str) – description of the plugin
action (callback) – function to call with the BinaryView and a LowLevelILFunction as arguments
is_valid (callback) – optional argument of a function passed a BinaryView and LowLevelILFunction to determine whether the plugin should be enabled for that view
None
>>> def my_plugin(bv: BinaryView, func: LowLevelILFunction):
>>> log_info(f"My plugin was called on func {func} in bv `{bv}`")
>>> PluginCommand.register_for_low_level_il_function("My Plugin", "My plugin description (not used)", my_plugin)
True
>>> def is_valid(bv: BinaryView, func: LowLevelILFunction) -> bool:
>>> return False
>>> PluginCommand.register_for_low_level_il_function("My Plugin (With Valid Function)", "My plugin description (not used)", my_plugin, is_valid)
True
Warning
Calling register_for_low_level_il_function with the same function name will replace the existing function but will leak the memory of the original plugin.
register_for_low_level_il_instruction Register a plugin to be called with a low level IL instruction argument
name (str) – name of the plugin (use ‘Folder\Name’ to have the menu item nested in a folder)
description (str) – description of the plugin
action (callback) – function to call with the BinaryView and a LowLevelILInstruction as arguments
is_valid (callback) – optional argument of a function passed a BinaryView and LowLevelILInstruction to determine whether the plugin should be enabled for that view
None
>>> def my_plugin(bv: BinaryView, inst: LowLevelILInstruction):
>>> log_info(f"My plugin was called on inst {inst} in bv `{bv}`")
>>> PluginCommand.register_for_low_level_il_instruction("My Plugin", "My plugin description (not used)", my_plugin)
True
>>> def is_valid(bv: BinaryView, inst: LowLevelILInstruction) -> bool:
>>> return False
>>> PluginCommand.register_for_low_level_il_instruction("My Plugin (With Valid Function)", "My plugin description (not used)", my_plugin, is_valid)
True
Warning
Calling register_for_low_level_il_instruction with the same function name will replace the existing function but will leak the memory of the original plugin.
register_for_medium_level_il_function Register a plugin to be called with a medium level IL function argument
name (str) – name of the plugin (use ‘Folder\Name’ to have the menu item nested in a folder)
description (str) – description of the plugin
action (callback) – function to call with the BinaryView and a MediumLevelILFunction as arguments
is_valid (callback) – optional argument of a function passed a BinaryView and MediumLevelILFunction to determine whether the plugin should be enabled for that view
None
>>> def my_plugin(bv: BinaryView, func: MediumLevelILFunction):
>>> log_info(f"My plugin was called on func {func} in bv `{bv}`")
>>> PluginCommand.register_for_medium_level_il_function("My Plugin", "My plugin description (not used)", my_plugin)
True
>>> def is_valid(bv: BinaryView, func: MediumLevelILFunction) -> bool:
>>> return False
>>> PluginCommand.register_for_medium_level_il_function("My Plugin (With Valid Function)", "My plugin description (not used)", my_plugin, is_valid)
True
Warning
Calling register_for_medium_level_il_function with the same function name will replace the existing function but will leak the memory of the original plugin.
register_for_medium_level_il_instruction Register a plugin to be called with a medium level IL instruction argument
name (str) – name of the plugin (use ‘Folder\Name’ to have the menu item nested in a folder)
description (str) – description of the plugin
action (callback) – function to call with the BinaryView and a MediumLevelILInstruction as arguments
is_valid (callback) – optional argument of a function passed a BinaryView and MediumLevelILInstruction to determine whether the plugin should be enabled for that view
None
>>> def my_plugin(bv: BinaryView, inst: MediumLevelILInstruction):
>>> log_info(f"My plugin was called on inst {inst} in bv `{bv}`")
>>> PluginCommand.register_for_medium_level_il_instruction("My Plugin", "My plugin description (not used)", my_plugin)
True
>>> def is_valid(bv: BinaryView, inst: MediumLevelILInstruction) -> bool:
>>> return False
>>> PluginCommand.register_for_medium_level_il_instruction("My Plugin (With Valid Function)", "My plugin description (not used)", my_plugin, is_valid)
True
Warning
Calling register_for_medium_level_il_instruction with the same function name will replace the existing function but will leak the memory of the original plugin.
register_for_project Register a plugin to be called with a project argument
name (str) – name of the plugin (use ‘Folder\Name’ to have the menu item nested in a folder)
description (str) – description of the plugin
action (callback) – function to call with the Project as an argument
is_valid (callback) – optional argument of a function passed a Project to determine whether the plugin should be enabled for that project
None
>>> def my_plugin(project: Project):
>>> log_info(f"My plugin was called on project: `{project}`")
>>> PluginCommand.register_for_project("My Plugin", "My plugin description (not used)", my_plugin)
True
>>> def is_valid(project: Project) -> bool:
>>> return False
>>> PluginCommand.register_for_project("My Plugin (With Valid Function)", "My plugin description (not used)", my_plugin, is_valid)
True
Warning
Calling register_for_project with the same function name will replace the existing function but will leak the memory of the original plugin.
register_for_range Register a plugin to be called with a range argument
name (str) – name of the plugin (use ‘Folder\Name’ to have the menu item nested in a folder)
description (str) – description of the plugin
action (callback) – function to call with the BinaryView, start address, and length as arguments
is_valid (callback) – optional argument of a function passed a BinaryView, start address, and length to determine whether the plugin should be enabled for that view
None
>>> def my_plugin(bv: BinaryView, start: int, length: int):
>>> log_info(f"My plugin was called on bv: `{bv}` at {hex(start)} of length {hex(length)}")
>>> PluginCommand.register_for_range("My Plugin", "My plugin description (not used)", my_plugin)
True
>>> def is_valid(bv: BinaryView, start: int, length: int) -> bool:
>>> return False
>>> PluginCommand.register_for_range("My Plugin (With Valid Function)", "My plugin description (not used)", my_plugin, is_valid)
True
Warning
Calling register_for_range with the same function name will replace the existing function but will leak the memory of the original plugin.
register_global Register a command globally
None
>>> def my_command():
>>> log_info(f"My command was called on bv")
>>> PluginCommand.register_global("My Command", "My command description (not used)", my_command)
True
>>> def is_valid() -> bool:
>>> return False
>>> PluginCommand.register_global("My Command (With Valid Function)", "My command description (not used)", my_plugin, is_valid)
True
Warning
Calling register_global with the same function name will replace the existing function but will leak the memory of the original plugin.
Bases: object
The class PluginCommandContext is used to access loaded plugins and their exposed methods with the context of a specific Binary VIew.
>>> bv = load("/tmp/file1")
>>> ctx = PluginCommandContext(bv);
>>> binexport = PluginCommand.get_valid_list(ctx)["BinExport"]
>>> binexport.execute(ctx)