Is there any way to get SDK API message when Ida Pro is closing? I write plug-in that connect with other application and I need to close connections when IDA is closing.

  • If this were OS-specific you could use some mechanism like window hooks on Windows, but I can see how an IDA API may be the better choice here.
    – 0xC0000022L
    Jul 4, 2018 at 13:44

2 Answers 2


Your plugin class can implement the term(self) method, which will be called when IDA unloads the plugin. Unloading a plugin might happen at different occasions depending on the value returned by your init(self) method when the plugin was loaded.

You should note the plugin may be loaded and unloaded several times during the execution of a single IDA instance, though. For example a plugin may be loaded once when IDA first starts without a loaded binary, and then be unloaded and reloaded when a binary is loaded (either an IDB or a binary loaded and analyzed for the first time).


The second way to solve the problem with getting close message is create term(self) method in the UIHook class but not in plugin class. The benefit of this way that is it usable with ida pro scripts not just plugins. Example: https://github.com/EiNSTeiN-/idapython/blob/master/examples/ex_uihook.py

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.