-
Notifications
You must be signed in to change notification settings - Fork 0
Plugins
In your plugin's __init__.py
, you should make sure to define a namespace and a plugin as global variables.
The namespace should be a string.
The plugin should point to a plugin class that extends the objection.utils.plugin.Plugin
class.
NOTE: Spaces in the namespace are not explicitly unsupported, but they will annoy the user because they need to be quoted to be parsed correctly.
Since plugins support being loaded under a different namespace, you should make no assumptions about the exact command being run to execute your plugin.
The namespace
variable is available as a class variable should you have a case where to determine this.
The implementation dict should follow the following format:
implementation = {
"meta": "A description of the module",
"commands": {
<COMMANDS>
}
}
A command should follow this specification:
"COMMAND_NAME": {
"meta": "A description of the command",
"exec": self.HANDLER_FUNCTION
}
Instead of a command, you can also make a submodule:
"SUBMODULE_NAME": {
"meta": "A description of the submodule",
"commands": {
<COMMANDS>
}
}
It is recommended to group commands that are related, but avoid nesting deeper than 3 levels.
To execute a command on the device, you must address the api
variable of the class.
Functions in python are accessed in snakecase, and translated to camelcase for the javascript side.
To make your life easier, you can place your script in an external file next to your __init__.py
, called index.js
.
If you want to include your script inline or use a different name or path for the file you can override the script
and script_path
class variables.
Use absolute paths, or python will try to resolve the path relatively to the running directory of objection
.
Make sure the functions you want to call from your plugin are available by exporting them via the global rpc.exports
object.
Remember to export your functions in camelcase!
An example plugin is available at SpeedyFireCyclone/objection-android-clipboard.