Write the first instance of the IDA plug in with python

  • 2020-09-28 09:00:34
  • OfStack

IDA plug-ins are compiled, more powerful IDC scripts that can perform more complex tasks than just using scripts. Compared with IDC scripting, python is lighter and more powerful. IDAPython, as a plug-in of IDA, has most of the functions of IDA SDK and can help us write python scripts to realize all the functions of IDC scripting language.

This article will start with a simple example showing how to write and install an IDA plug-in using python.

1. Write the plug-in file msg. py

from idaapi import *
class myIdaPlugin(plugin_t):
 wanted_name="my ida plugin"
 comment="my ida plugin"
 help="Something helpful"
 def init(self):
  msg("Ida plugin init called.\n")
  return PLUGIN_OK
 def term(self):
  msg("Ida plugin term called.\n")
 def run(self,arg):
  warning("Ida plugin run(%d) called.\n"%arg)
 return myIdaPlugin()

2, will msg. py files in IDADIR/plugins directory, modify IDADIR/plugins/plugins cfg files, set plug_name value to IDA menu bar shows the menu, plugin_file. A value msg py file name, remember to take the extension, or is the default system. plw or. p64, save and restart IDA can.

Related articles: