Python idaapi.add_menu_item() Examples

The following are 9 code examples of idaapi.add_menu_item(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module idaapi , or try the search function .
Example #1
Source File: IDASynergy.py    From IDASynergy with MIT License 6 votes vote down vote up
def insert(self, option_groups=[]):
        if "enable" in option_groups:
            self.enable_menu_item = idaapi.add_menu_item("FILE/", "Enable IDASynergy for this IDB", "", 0, self.on_enable_plugin, ())
            #self.remove_hooks()
        else:
            if "svn" in option_groups and self.svn_menuitems == []:
                self.svn_menuitems.append( idaapi.add_menu_item("FILE/", "IDASynergy SVN Checkout...", "", 0, self.on_checkout, ()) )
                self.svn_menuitems.append( idaapi.add_menu_item("FILE/", "IDASynergy SVN Commit...", "CTRL+SHIFT+C", 0, self.on_commit, () ))
                self.svn_menuitems.append( idaapi.add_menu_item("FILE/", "IDASynergy SVN Update...", "CTRL+SHIFT+U", 0, self.on_update, () ))
            if "full" in option_groups and self.ex_addmenu_item_ctx == []:
                self.ex_addmenu_item_ctx.append( idaapi.add_menu_item("Options/", "IDASynergy...", "", 0, self.on_config, ()) )
                self.ex_addmenu_item_ctx.append( idaapi.add_menu_item("FILE/", "IDASynergy Load from local repository", "", 0, self.on_import_all, ()) )
                self.ex_addmenu_item_ctx.append( idaapi.add_menu_item("FILE/", "IDASynergy Export analysis to file", "", 0, self.on_export, ()) )
                self.ex_addmenu_item_ctx.append( idaapi.add_menu_item("FILE/", "IDASynergy Import analysis from file", "", 0, self.on_import, ()))
                #self.insert_hooks()
                self.remove(["enable"]) 
Example #2
Source File: apply_callee_type_plugin.py    From flare-ida with Apache License 2.0 6 votes vote down vote up
def installMenu():
    #hack -> stashing a flag under idaapi to prevent multiple menu items from appearing
    if hasattr(sys.modules['idaapi'], '_apply_callee_type_plugin_installFlag'):
        #print('Skipping menu install: already present')
        return
    if using_ida7api:
        return installMenuIda7()
    global ex_addmenu_item_ctx
    ex_addmenu_item_ctx = idaapi.add_menu_item(
        MENU_PATH, 
        PLUGIN_NAME, 
        PREFERRED_SHORTCUT, 
        0, 
        doApplyCallee, 
        tuple("hello world")
    )
    if ex_addmenu_item_ctx  is None:
        print('Failed to init apply_callee_type_plugin')

    setattr(sys.modules['idaapi'], '_apply_callee_type_plugin_installFlag', True) 
Example #3
Source File: diaphora_ida.py    From maltindex with GNU General Public License v2.0 5 votes vote down vote up
def register_menu(self):
    global g_bindiff
    g_bindiff = self

    idaapi.add_menu_item("Edit/Plugins/", "Diaphora - Show results", "F3", 0, show_choosers, ())
    idaapi.add_menu_item("Edit/Plugins/", "Diaphora - Save results", None, 0, save_results, ())
    idaapi.add_menu_item("Edit/Plugins/", "Diaphora - Load results", None, 0, load_results, ())
    Warning("""AUTOHIDE REGISTRY\nIf you close one tab you can always re-open it by pressing F3
or selecting Edit -> Plugins -> Diaphora - Show results""") 
Example #4
Source File: ida_batch_decompile.py    From ida-batch_decompile with GNU General Public License v3.0 5 votes vote down vote up
def init(self):
        NO_HOTKEY = ""
        SETMENU_INS = 0
        NO_ARGS = tuple()

        logger.debug("[+] %s.init()" % self.__class__.__name__)
        self.menuitems = []

        logger.debug("[+] setting up menus for ida version %s" % idaapi.IDA_SDK_VERSION)

        if idaapi.IDA_SDK_VERSION >= 700:
            # >= 700
            action_desc = idaapi.action_desc_t("tintinweb:batchdecompile:load", self.wanted_name, IdaDecompileUiActionHandler(self))
            idaapi.register_action(action_desc)
            idaapi.attach_action_to_menu(''.join(self.wanted_menu), "tintinweb:batchdecompile:load", idaapi.SETMENU_APP)

        else:
            menu = idaapi.add_menu_item(self.wanted_menu[0],
                                        self.wanted_menu[1],
                                        NO_HOTKEY,
                                        SETMENU_INS,
                                        self.menu_config,
                                        NO_ARGS)

            self.menuitems.append(menu)

        return idaapi.PLUGIN_KEEP 
Example #5
Source File: Python_editor.py    From Python_editor with The Unlicense 5 votes vote down vote up
def AddMenuElements(self):
        idaapi.add_menu_item("File/", "Code editor", "Alt-E", 0, self.popeye, ())
        idaapi.set_menu_item_icon("File/Code editor", idaapi.load_custom_icon(":/ico/python.png")) 
Example #6
Source File: Python_editor.py    From Python_editor with The Unlicense 5 votes vote down vote up
def AddMenuElements(self):
        idaapi.add_menu_item("File/", "Code editor", "Alt-E", 0, self.popeye, ())
        idaapi.set_menu_item_icon("File/Code editor", idaapi.load_custom_icon(":/ico/python.png")) 
Example #7
Source File: ui.py    From ida-minsc with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add(cls, path, name, callable, hotkey='', flags=0, args=()):
        '''Register a `callable` as a menu item at the specified `path` with the provided `name`.'''

        # check to see if our menu item is in our cache and remove it if so
        if (path, name) in cls.state:
            cls.rm(path, name)

        # now we can add the menu item since everything is ok
        # XXX: I'm not sure if the path needs to be utf8 encoded or not
        res = internal.utils.string.to(name)
        ctx = idaapi.add_menu_item(path, res, hotkey, flags, callable, args)
        cls.state[path, name] = ctx 
Example #8
Source File: vxhunter_ida.py    From vxhunter with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def init(self):
        # register popup menu handlers
        try:
            # Register Auto Fix IDB handler
            VxHunterMCFixIDB.register(self, "Auto Fix IDB With symbol table")
            # Register Fix Code handler
            VxHunterMCFixCode.register(self, "Fix Code from start address to end address")
            # Register Fix Ascii handler
            VxHunterMCFixAscii.register(self, "Fix Ascii string table with giving address")
            # Register Load symbol file handler
            VxHunterMCLoadSymbolFile.register(self, "Load VxWorks symbol file")

        except Exception as err:
            print("Got Error!!!: %s" % err)

        # setup popup menu
        if idaapi.IDA_SDK_VERSION >= 700:
            # Add menu IDA >= 7.0
            idaapi.attach_action_to_menu("Edit/VxHunter/", VxHunterMCFixIDB.get_name(), idaapi.SETMENU_APP)
            idaapi.attach_action_to_menu("Edit/VxHunter/", VxHunterMCFixCode.get_name(), idaapi.SETMENU_APP)
            idaapi.attach_action_to_menu("Edit/VxHunter/", VxHunterMCFixAscii.get_name(), idaapi.SETMENU_APP)
            idaapi.attach_action_to_menu("Edit/VxHunter/", VxHunterMCLoadSymbolFile.get_name(), idaapi.SETMENU_APP)
        else:
            # add Vxhunter menu
            menu = idaapi.add_menu_item("Edit/VxHunter/", "Auto Fix IDB1", "", 1, self.handler_auto_fix_idb, None)
            if menu is not None:
                pass

        print("=" * 80)
        return idaapi.PLUGIN_KEEP 
Example #9
Source File: fcatalog_plugin.py    From fcatalog_client with GNU General Public License v3.0 4 votes vote down vote up
def init(self):
        """
        Initialize plugin:
        """
        self._client_config = load_config()
        self._fcc = None
        if self._client_config is not None:
            self._fcc = FCatalogClient(\
                    (self._client_config.remote_host,\
                    self._client_config.remote_port),\
                    self._client_config.db_name,\
                    self._client_config.exclude_pattern)

        # Make sure that self._client config is built, even if it doesn't have
        # any fields inside:
        if self._client_config is None:
            self._client_config = ClientConfig()

        # Set up menus:
        ui_path = "Edit/"
        self.menu_contexts = []
        self.menu_contexts.append(idaapi.add_menu_item(ui_path,
                                "FCatalog: Configure",
                                "",
                                0,
                                self._show_conf_form,
                                (None,)))

        self.menu_contexts.append(idaapi.add_menu_item(ui_path,
                                "FCatalog: Commit Functions",
                                "",
                                0,
                                self._commit_funcs,
                                (None,)))
        self.menu_contexts.append(idaapi.add_menu_item(ui_path,
                                "FCatalog: Find Similars",
                                "",
                                0,
                                self._find_similars,
                                (None,)))
        self.menu_contexts.append(idaapi.add_menu_item(ui_path,
                                "FCatalog: Clean IDB",
                                "",
                                0,
                                self._clean_idb,
                                (None,)))

        return idaapi.PLUGIN_KEEP