summaryrefslogtreecommitdiff
path: root/docs/dev
diff options
context:
space:
mode:
Diffstat (limited to 'docs/dev')
-rw-r--r--docs/dev/cookbook.md14
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/dev/cookbook.md b/docs/dev/cookbook.md
index 4d9f0d77..6bf7ee2f 100644
--- a/docs/dev/cookbook.md
+++ b/docs/dev/cookbook.md
@@ -287,3 +287,17 @@ def invoke_plugin(name: str, bv: BinaryView, address=0, length = 0,function=None
cmds = PluginCommand.get_valid_list(ctx)
cmds[name].execute(ctx)
```
+
+### Add variable to the Python Console
+```python
+from binaryninja import PythonScriptingProvider, PythonScriptingInstance
+
+def get_my_foo(instance: PythonScriptingInstance):
+ # See scriptingprovider.py for details and implementations of other variables
+ return instance.interpreter.active_addr & 0xffffff
+
+PythonScriptingProvider.register_magic_variable(
+ "my_foo",
+ get_my_foo
+)
+``` \ No newline at end of file