From 26c2df9ace8ce372ad14e114edd0c2713c033f67 Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Wed, 31 May 2017 16:28:52 -0400 Subject: Example implementing notification callbacks --- python/examples/notification_callbacks.py | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 python/examples/notification_callbacks.py (limited to 'python/examples/notification_callbacks.py') diff --git a/python/examples/notification_callbacks.py b/python/examples/notification_callbacks.py new file mode 100644 index 00000000..b7c9cde9 --- /dev/null +++ b/python/examples/notification_callbacks.py @@ -0,0 +1,51 @@ +from binaryninja import BinaryDataNotification, PluginCommand, log_info +import inspect + +def reg_notif(view): + demo_notification = DemoNotification(view) + view.register_notification(demo_notification) + +class DemoNotification(BinaryDataNotification): + def __init__(self, view): + self.view = view + + def data_written(self, *args): + log_info(inspect.stack()[0][3] + str(args)) + + def data_inserted(self, *args): + log_info(inspect.stack()[0][3] + str(args)) + + def data_removed(self, *args): + log_info(inspect.stack()[0][3] + str(args)) + + def function_added(self, *args): + log_info(inspect.stack()[0][3] + str(args)) + + def function_removed(self, *args): + log_info(inspect.stack()[0][3] + str(args)) + + def function_updated(self, *args): + log_info(inspect.stack()[0][3] + str(args)) + + def data_var_added(self, *args): + log_info(inspect.stack()[0][3] + str(args)) + + def data_var_updated(self, *args): + log_info(inspect.stack()[0][3] + str(args)) + + def data_var_removed(self, *args): + log_info(inspect.stack()[0][3] + str(args)) + + def string_found(self, *args): + log_info(inspect.stack()[0][3] + str(args)) + + def string_removed(self, *args): + log_info(inspect.stack()[0][3] + str(args)) + + def type_defined(self, *args): + log_info(inspect.stack()[0][3] + str(args)) + + def type_undefined(self, *args): + log_info(inspect.stack()[0][3] + str(args)) + +PluginCommand.register("Register Notification", "", reg_notif) -- cgit v1.3.1