Python idaapi.action_desc_t() Examples

The following are 28 code examples of idaapi.action_desc_t(). 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 Project: Sark   Author: tmr232   File: ui.py    License: MIT License 6 votes vote down vote up
def get_desc(cls):
        """Get a descriptor for this handler."""
        name = cls.get_name()
        text = cls.TEXT
        handler = cls()
        hotkey = cls.HOTKEY
        tooltip = cls.TOOLTIP
        icon = cls.ICON
        action_desc = idaapi.action_desc_t(
            name,
            text,
            handler,
            hotkey,
            tooltip,
            icon,
        )
        return action_desc 
Example #2
Source Project: Sark   Author: tmr232   File: autoenum.py    License: MIT License 6 votes vote down vote up
def init(self):
        self._last_enum = ""

        self.rename_action_desc = idaapi.action_desc_t('AutoEnum:RenameImmediate',
                                                       'Rename immediate value',
                                                       RenameImmediateHandler(),
                                                       'Ctrl+Shift+M',
                                                       'Rename immediate value',
                                                       -1)
        idaapi.register_action(self.rename_action_desc)

        self.autoenum_action_desc = idaapi.action_desc_t('AutoEnum:AutoEnum',
                                                         'Automatically create enum',
                                                         AutoEnumHandler(),
                                                         'Shift+M',
                                                         'Automatically create enum',
                                                         -1)
        idaapi.register_action(self.autoenum_action_desc)

        return idaapi.PLUGIN_KEEP 
Example #3
Source Project: prefix   Author: gaasedelen   File: ida_prefix.py    License: MIT License 6 votes vote down vote up
def _init_action_bulk(self):
        """
        Register the bulk prefix action with IDA.
        """

        # load the icon for this action
        self._bulk_icon_id = idaapi.load_custom_icon(plugin_resource("bulk.png"))

        # describe the action
        action_desc = idaapi.action_desc_t(
            self.ACTION_BULK,                        # The action name.
            "Prefix selected functions",             # The action text.
            IDACtxEntry(bulk_prefix),                # The action handler.
            None,                                    # Optional: action shortcut
            "Assign a user prefix to the selected functions", # Optional: tooltip
            self._bulk_icon_id                       # Optional: the action icon
        )

        # register the action with IDA
        assert idaapi.register_action(action_desc), "Action registration failed" 
Example #4
Source Project: prefix   Author: gaasedelen   File: ida_prefix.py    License: MIT License 6 votes vote down vote up
def _init_action_clear(self):
        """
        Register the clear prefix action with IDA.
        """

        # load the icon for this action
        self._clear_icon_id = idaapi.load_custom_icon(plugin_resource("clear.png"))

        # describe the action
        action_desc = idaapi.action_desc_t(
            self.ACTION_CLEAR,                       # The action name.
            "Clear prefixes",                        # The action text.
            IDACtxEntry(clear_prefix),               # The action handler.
            None,                                    # Optional: action shortcut
            "Clear user prefixes from the selected functions", # Optional: tooltip
            self._clear_icon_id                      # Optional: the action icon
        )

        # register the action with IDA
        assert idaapi.register_action(action_desc), "Action registration failed" 
Example #5
Source Project: prefix   Author: gaasedelen   File: ida_prefix.py    License: MIT License 6 votes vote down vote up
def _init_action_recursive(self):
        """
        Register the recursive rename action with IDA.
        """

        # load the icon for this action
        self._recursive_icon_id = idaapi.load_custom_icon(plugin_resource("recursive.png"))

        # describe the action
        action_desc = idaapi.action_desc_t(
            self.ACTION_RECURSIVE,                   # The action name.
            "Recursive function prefix",             # The action text.
            IDACtxEntry(recursive_prefix_cursor),    # The action handler.
            None,                                    # Optional: action shortcut
            "Recursively prefix callees of this function", # Optional: tooltip
            self._recursive_icon_id                  # Optional: the action icon
        )

        # register the action with IDA
        assert idaapi.register_action(action_desc), "Action registration failed" 
Example #6
Source Project: ida-scripts   Author: sam-b   File: neo4ida.py    License: The Unlicense 6 votes vote down vote up
def registerAction(self):
        action_desc = idaapi.action_desc_t(
        self.id,
        self.name,
        self,
		"",
        self.tooltip,
		self.icon
		)      
        if not idaapi.register_action(action_desc):
            return False
        if not idaapi.attach_action_to_menu(self.menuPath, self.id, 0):
            return False
        if not idaapi.attach_action_to_toolbar("AnalysisToolBar", self.id):
            return False
        return True 
Example #7
Source Project: deREferencing   Author: danigargu   File: actions.py    License: GNU General Public License v3.0 6 votes vote down vote up
def register_menu_actions(form):
    widget = form.GetWidget()
    for action in form.menu_actions:
        act_name = action.name
        if act_name != '-':
            act_name = "%s:%s" % (PLUGIN_NAME, action.name)
            idaapi.register_action(
                idaapi.action_desc_t(
                    act_name, 
                    action.title,
                    ActionHandler(form, action), 
                    action.shortcut, 
                    action.tooltip, 
                    action.icon
                )
            )
        if action.checkable is not None:
            idaapi.update_action_checkable(act_name, True)
            idaapi.update_action_checked(act_name, action.checkable)

        idaapi.attach_action_to_popup(widget, None, act_name)

# ----------------------------------------------------------------------- 
Example #8
Source Project: deREferencing   Author: danigargu   File: dereferencing.py    License: GNU General Public License v3.0 6 votes vote down vote up
def register_munu_actions():
    act_registers = '%s:registers' % PLUGIN_NAME
    act1 = idaapi.action_desc_t(
        act_registers,
        REGS_WIDGET_TITLE,
        StartHandler(REGS_WIDGET_TITLE),
        'Alt-Shift-D',
        'Start plugin',
        122
    )
    idaapi.register_action(act1)
    idaapi.attach_action_to_menu(DBG_MENU_PATH, act_registers, idaapi.SETMENU_APP)

    act_stack = '%s:stack' % PLUGIN_NAME
    act2 = idaapi.action_desc_t(act_stack,
        STACK_WIDGET_TITLE,
        StartHandler(STACK_WIDGET_TITLE),
        'Alt-Shift-E',
        'Start plugin',
        122
    )
    idaapi.register_action(act2)
    idaapi.attach_action_to_menu(DBG_MENU_PATH, act_stack, idaapi.SETMENU_APP) 
Example #9
Source Project: win_driver_plugin   Author: FSecureLABS   File: win_driver_plugin.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def registerAction(self):
        action_desc = idaapi.action_desc_t(
            self.id,
            self.name,
            self,
            self.shortcut,
            self.tooltip,
            0
        )
        if not idaapi.register_action(action_desc):
            return False
        if not idaapi.attach_action_to_menu(self.menuPath, self.id, 0):
            return False
        return True 
Example #10
Source Project: win_driver_plugin   Author: FSecureLABS   File: win_driver_plugin.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def register_dynamic_action(form, popup, description, handler):
    """Registers a new item in a popup which will trigger a function when selected""" 

    # Note the 'None' as action name (1st parameter).
    # That's because the action will be deleted immediately
    # after the context menu is hidden anyway, so there's
    # really no need giving it a valid ID.
    action = idaapi.action_desc_t(None, description, handler)
    idaapi.attach_dynamic_action_to_popup(form, popup, action, 'Driver Plugin/') 
Example #11
Source Project: grap   Author: AirbusCyber   File: PatternGenerationWidget.py    License: MIT License 5 votes vote down vote up
def _createContextActions(self): 
        actions = [
            ("grap:pg:set_root", None, "[grap] Set root node", self._onSetRootNode),
            ("grap:pg:add_target", None, "[grap] Add target node", self._onAddTargetNode),
            ("grap:pg:match_default", config['icons_path'] + "icons8-asterisk-24.png", "[grap] Default match (apply options)", self._onSetMatchDefault),
            ("grap:pg:match_full", None, "[grap] Full match", self._onSetMatchFull),
            ("grap:pg:match_opcode_arg1", None, "[grap] Opcode+arg1", self._onSetMatchOpcodeArg1),
            ("grap:pg:match_opcode_arg2", None, "[grap] Opcode+arg2", self._onSetMatchOpcodeArg2),
            ("grap:pg:match_opcode_arg3", None, "[grap] Opcode+arg3", self._onSetMatchOpcodeArg3),
            ("grap:pg:match_opcode", None, "[grap] Opcode", self._onSetMatchOpcode),
            ("grap:pg:match_wildcard", None, "[grap] Wildcard: *", self._onSetMatchWildcard),
            ("grap:pg:remove_target", config['icons_path'] + "icons8-delete.png", "[grap] Remove target node", self._onRemoveTargetNode)
        ]

        for actionId, icon_path, text, method in (a for a in actions):
            if icon_path is not None and icon_path != "":
                icon_number = idaapi.load_custom_icon(icon_path)
                # Describe the action
                action_desc = idaapi.action_desc_t(
                    actionId,  # The action name. This acts like an ID and must be unique
                    text,  # The action text.
                    PatternGenerationHandler(method), # The action handler.
                    None,
                    None,
                    icon_number)  
            else:
                # Describe the action
                action_desc = idaapi.action_desc_t(
                    actionId,  # The action name. This acts like an ID and must be unique
                    text,  # The action text.
                    PatternGenerationHandler(method)) # The action handler.  

            # Register the action
            idaapi.register_action(action_desc)

        self.actionsDefined = True 
Example #12
Source Project: BRUTAL-IDA   Author: tmr232   File: brutal_ida.py    License: MIT License 5 votes vote down vote up
def init(brutal_self):
        idaapi.unregister_action('Undo')
        idaapi.unregister_action('Redo')

        brutal_self.brutal_action_handler = BrutalActionHandler()
        brutal_action_desc = idaapi.action_desc_t('BRUTAL', 'BRUTAL IDA', brutal_self.brutal_action_handler, '',
                                                  'IDA', BRUTAL6_ICON)
        idaapi.register_action(brutal_action_desc)
        idaapi.create_toolbar('BRUTAL IDA', 'BRUTAL IDA')

        brutal_self.brutal_letter_handlers = []

        for brutal_letter in 'BRUTAL':
            brutal_letter_handler = BrutalLetterHandler()
            brutal_self.brutal_letter_handlers.append(brutal_letter_handler)

            brutal_label = 'BRUTAL {}'.format(brutal_letter)
            brutal_letter_desc = idaapi.action_desc_t(brutal_label,
                                                      brutal_label,
                                                      brutal_letter_handler,
                                                      '',
                                                      brutal_letter,
                                                      BRUTAL_LETTERS[brutal_letter])
            idaapi.register_action(brutal_letter_desc)
            idaapi.attach_action_to_toolbar('BRUTAL IDA', brutal_label)

        idaapi.attach_action_to_toolbar('BRUTAL IDA', 'BRUTAL')

        brutal_self.brutal_hotkey = idaapi.add_hotkey('Ctrl+Z', brutal_self.dispatch_brutality)

        return idaapi.PLUGIN_KEEP 
Example #13
Source Project: heap-viewer   Author: danigargu   File: heap_viewer.py    License: GNU General Public License v3.0 5 votes vote down vote up
def add_menus(self):
        # To avoid creating multiple plugin_t instances
        this = self
        class StartHandler(idaapi.action_handler_t):
            def __init__(self):
                idaapi.action_handler_t.__init__(self)
                
            def activate(self, ctx):
                this.run()
                return 1

            def update(self, ctx):
                return idaapi.AST_ENABLE_ALWAYS

        act_name = '%s:start' % PLUGNAME
        act_desc = idaapi.action_desc_t(
            act_name,       # The action name. Must be unique
            PLUGNAME,       # Action Text
            StartHandler(), # Action handler
            None,           # Optional shortcut
            'Start plugin', # Action tooltip
            122             # Icon
        )
        idaapi.register_action(act_desc)
        idaapi.attach_action_to_menu(
            'Debugger/Debugger windows/',
            act_name,
            idaapi.SETMENU_APP
        ) 
Example #14
Source Project: DIE   Author: ynvb   File: DIE.py    License: MIT License 5 votes vote down vote up
def add_menu_item_helper(self, name, text, tooltip, handler, icon, shortcut):
        description = idaapi.action_desc_t(name, text, handler, shortcut, tooltip, icon)
        idaapi.register_action(description)
        idaapi.attach_action_to_menu("DIE/" + text, name, idaapi.SETMENU_APP)

        self._menus_names.append(name) 
Example #15
Source Project: Sark   Author: tmr232   File: highlight_calls.py    License: MIT License 5 votes vote down vote up
def init(self):
        self.lines = set()
        self.settings = IDASettings('HighlightCalls')
        try:
            self.set_color(self.settings['color'])
        except KeyError:
            self.settings.user['color'] = HIGHLIGHT_COLOR
            self.set_color(HIGHLIGHT_COLOR)
        self.ui_hooks = UiHooks(self.lines)

        self.toggle_action_desc = idaapi.action_desc_t('HighlightCalls:Toggle',
                                                       'Toggle call highlighting',
                                                       ToggleHighlightHandler(self.enable_highlights,
                                                                              self.disable_highlights),
                                                       '',
                                                       'Toggle call highlighting',
                                                       -1)
        idaapi.register_action(self.toggle_action_desc)

        self.color_selector = idaapi.action_desc_t('HighlightCalls:SelectColor',
                                                   'Select highlight color',
                                                   SelectColorHandler(set_color=self.set_color),
                                                   '',
                                                   'Select highlight color',
                                                   -1)
        idaapi.register_action(self.color_selector)

        idaapi.attach_action_to_menu('View/', self.toggle_action_desc.name, idaapi.SETMENU_APP)
        idaapi.attach_action_to_menu('View/', self.color_selector.name, idaapi.SETMENU_APP)

        return idaapi.PLUGIN_KEEP 
Example #16
Source Project: lighthouse   Author: gaasedelen   File: ida_integration.py    License: MIT License 5 votes vote down vote up
def _install_load_file(self):
        """
        Install the 'File->Load->Code coverage file...' menu entry.
        """

        # create a custom IDA icon
        icon_path = plugin_resource(os.path.join("icons", "load.png"))
        icon_data = open(icon_path, "rb").read()
        self._icon_id_file = idaapi.load_custom_icon(data=icon_data)

        # describe a custom IDA UI action
        action_desc = idaapi.action_desc_t(
            self.ACTION_LOAD_FILE,                   # The action name
            "~C~ode coverage file...",               # The action text
            IDACtxEntry(self.interactive_load_file), # The action handler
            None,                                    # Optional: action shortcut
            "Load individual code coverage file(s)", # Optional: tooltip
            self._icon_id_file                       # Optional: the action icon
        )

        # register the action with IDA
        result = idaapi.register_action(action_desc)
        if not result:
            RuntimeError("Failed to register load_file action with IDA")

        # attach the action to the File-> dropdown menu
        result = idaapi.attach_action_to_menu(
            "File/Load file/",      # Relative path of where to add the action
            self.ACTION_LOAD_FILE,  # The action ID (see above)
            idaapi.SETMENU_APP      # We want to append the action after ^
        )
        if not result:
            RuntimeError("Failed action attach load_file")

        logger.info("Installed the 'Code coverage file' menu entry") 
Example #17
Source Project: lighthouse   Author: gaasedelen   File: ida_integration.py    License: MIT License 5 votes vote down vote up
def _install_load_batch(self):
        """
        Install the 'File->Load->Code coverage batch...' menu entry.
        """

        # create a custom IDA icon
        icon_path = plugin_resource(os.path.join("icons", "batch.png"))
        icon_data = open(icon_path, "rb").read()
        self._icon_id_batch = idaapi.load_custom_icon(data=icon_data)

        # describe a custom IDA UI action
        action_desc = idaapi.action_desc_t(
            self.ACTION_LOAD_BATCH,                   # The action name
            "~C~ode coverage batch...",               # The action text
            IDACtxEntry(self.interactive_load_batch), # The action handler
            None,                                     # Optional: action shortcut
            "Load and aggregate code coverage files", # Optional: tooltip
            self._icon_id_batch                       # Optional: the action icon
        )

        # register the action with IDA
        result = idaapi.register_action(action_desc)
        if not result:
            RuntimeError("Failed to register load_batch action with IDA")

        # attach the action to the File-> dropdown menu
        result = idaapi.attach_action_to_menu(
            "File/Load file/",      # Relative path of where to add the action
            self.ACTION_LOAD_BATCH, # The action ID (see above)
            idaapi.SETMENU_APP      # We want to append the action after ^
        )
        if not result:
            RuntimeError("Failed action attach load_batch")

        logger.info("Installed the 'Code coverage batch' menu entry") 
Example #18
Source Project: lighthouse   Author: gaasedelen   File: ida_integration.py    License: MIT License 5 votes vote down vote up
def _install_open_coverage_xref(self):
        """
        Install the right click 'Coverage Xref' context menu entry.
        """

        # create a custom IDA icon
        icon_path = plugin_resource(os.path.join("icons", "batch.png"))
        icon_data = open(icon_path, "rb").read()
        self._icon_id_xref = idaapi.load_custom_icon(data=icon_data)

        # describe a custom IDA UI action
        action_desc = idaapi.action_desc_t(
            self.ACTION_COVERAGE_XREF,                # The action name
            "Xrefs coverage sets...",                 # The action text
            IDACtxEntry(self._pre_open_coverage_xref),# The action handler
            None,                                     # Optional: action shortcut
            "List coverage sets containing this address", # Optional: tooltip
            self._icon_id_xref                        # Optional: the action icon
        )

        # register the action with IDA
        result = idaapi.register_action(action_desc)
        if not result:
            RuntimeError("Failed to register coverage_xref action with IDA")

        self._ui_hooks.hook()
        logger.info("Installed the 'Coverage Xref' menu entry") 
Example #19
Source Project: lighthouse   Author: gaasedelen   File: ida_integration.py    License: MIT License 5 votes vote down vote up
def _install_open_coverage_overview(self):
        """
        Install the 'View->Open subviews->Coverage Overview' menu entry.
        """

        # create a custom IDA icon
        icon_path = plugin_resource(os.path.join("icons", "overview.png"))
        icon_data = open(icon_path, "rb").read()
        self._icon_id_overview = idaapi.load_custom_icon(data=icon_data)

        # describe a custom IDA UI action
        action_desc = idaapi.action_desc_t(
            self.ACTION_COVERAGE_OVERVIEW,            # The action name
            "~C~overage Overview",                    # The action text
            IDACtxEntry(self.open_coverage_overview), # The action handler
            None,                                     # Optional: action shortcut
            "Open database code coverage overview",   # Optional: tooltip
            self._icon_id_overview                    # Optional: the action icon
        )

        # register the action with IDA
        result = idaapi.register_action(action_desc)
        if not result:
            RuntimeError("Failed to register open coverage overview action with IDA")

        # attach the action to the View-> dropdown menu
        result = idaapi.attach_action_to_menu(
            "View/Open subviews/Hex dump", # Relative path of where to add the action
            self.ACTION_COVERAGE_OVERVIEW, # The action ID (see above)
            idaapi.SETMENU_INS             # We want to insert the action before ^
        )
        if not result:
            RuntimeError("Failed action attach to 'View/Open subviews' dropdown")

        logger.info("Installed the 'Coverage Overview' menu entry") 
Example #20
Source Project: miasm   Author: cea-sec   File: menu.py    License: GNU General Public License v2.0 5 votes vote down vote up
def register(self, name, label, shortcut=None, tooltip=None, icon=-1):
        action = idaapi.action_desc_t(
            name,    # The action name. This acts like an ID and must be unique
            label,   # The action text.
            self,    # The action handler.
            shortcut,# Optional: the action shortcut
            tooltip, # Optional: the action tooltip (available in menus/toolbar)
            icon,    # Optional: the action icon (shows when in menus/toolbars)
        )
        idaapi.register_action(action)
        self.name = name
        return action 
Example #21
Source Project: idamagnum   Author: lucasg   File: idamagnum_plugin.py    License: MIT License 5 votes vote down vote up
def _attach_to_menu_items(self):

        self.search_magic_desc = idaapi.action_desc_t(
            'idamagnum:searchmagic',             
            'search magic number ...',              
            SearchMagicNumber(self),         
            "Shift+M",                     
            'Search this value on MagnumDB', 
        )

        self.configure_plugin_desc = idaapi.action_desc_t(
            'idamagnum:configure',             
            'Configure',              
            ConfigureIdaMagnum(self),         
            "",                     
            'Configure plugin',
        )

        idaapi.register_action(self.search_magic_desc)
        idaapi.register_action(self.configure_plugin_desc)

        idaapi.attach_action_to_menu(
            'Edit/Plugins/IdaMagnum/',
            'idamagnum:searchmagic',
            idaapi.SETMENU_APP
        )

        idaapi.attach_action_to_menu(
            'Edit/Plugins/IdaMagnum/',
            'idamagnum:configure',
            idaapi.SETMENU_APP
        )

        return 0 
Example #22
Source Project: IDAFuzzy   Author: Ga-ryo   File: ida_fuzzy.py    License: MIT License 5 votes vote down vote up
def init(self):
        print("Fuzzy Search Plugin loaded.")
        idaapi.register_action(
            idaapi.action_desc_t("fz:fuzzysearch", "Fuzzy Search", fuzzy_search_handler(), "Shift+SPACE", "", -1))

        return idaapi.PLUGIN_KEEP 
Example #23
Source Project: ida-batch_decompile   Author: tintinweb   File: ida_batch_decompile.py    License: 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 #24
Source Project: UEFI_RETool   Author: yeggor   File: ui.py    License: MIT License 5 votes vote down vote up
def init_menu(action_handler):
    action = '{}:loadfile'.format(NAME)
    action_desc = idaapi.action_desc_t(
        action,
        '{}...'.format(NAME),
        action_handler,
        'Ctrl+Alt+J',
        '{} dependency browser'.format(NAME),
    )
    idaapi.register_action(action_desc)
    idaapi.attach_action_to_menu('File', action, idaapi.SETMENU_APP) 
Example #25
Source Project: WatchDBG-IDA   Author: Tekiter   File: util.py    License: MIT License 5 votes vote down vote up
def register(self, id, content, callback, icon=-1, shortcut=None):
        nid = self._convert(id)
        action = idaapi.action_desc_t(nid, content, ActionHandler(nid, callback), shortcut, None, icon)
        self._actions[id] = action
        idaapi.register_action(action) 
Example #26
Source Project: win_driver_plugin   Author: FSecureLABS   File: create_tab_table.py    License: BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
def create_ioctl_tab(tracker, modal=False):
    global ioctl_tracker
    ioctl_tracker = tracker
    items = get_all_defines()
    idaapi.register_action(
        idaapi.action_desc_t(
            "choose2:remove_ioctl",
            "Invalid IOCTL",
            remove_ioctl(items)
        )
    )
    action = "send_ioctl"
    actname = "choose2:act%s" % action
    idaapi.register_action(
        idaapi.action_desc_t(
            actname,
            "Send IOCTL",
            send_ioctl_handler_t(items)))
    idaapi.register_action(
        idaapi.action_desc_t(
            "choose2:actcopy_defines",
            "Copy All Defines",
            copy_defines_handler_t(items)))
            
    idaapi.register_action(
        idaapi.action_desc_t(
            "choose2:actstop_unload",
            "Stop & Unload Driver",
            stop_unload_handler_t()))
    idaapi.register_action(
        idaapi.action_desc_t(
            "choose2:actstart_load",
            "Load & Start Driver",
            start_load_handler_t()))
    global c
    c = MyChoose2("IOCTL Code Viewer", items, modal=modal)
    c.show()
    form = idaapi.get_current_tform()
    idaapi.attach_action_to_popup(form, None, "choose2:act%s" % action)
    idaapi.attach_action_to_popup(form, None, "choose2:actcopy_defines")
    idaapi.attach_action_to_popup(form, None, "choose2:actstop_unload")
    idaapi.attach_action_to_popup(form, None, "choose2:actstart_load")
    idaapi.attach_action_to_popup(form, None, "choose2:remove_ioctl") 
Example #27
Source Project: x64dbgida   Author: x64dbg   File: x64dbgida.py    License: MIT License 4 votes vote down vote up
def init(self):
        global initialized

        if initialized is False:
            initialized = True
            if idaapi.IDA_SDK_VERSION >= 700:
                # populating action menus
                action_desc = idaapi.action_desc_t(
                    'my:aboutaction',  # The action name. This acts like an ID and must be unique
                    'About!',  # The action text.
                    AboutHandler(),  # The action handler.
                    '',  # Optional: the action shortcut
                    'About X64dbg ida',  # Optional: the action tooltip (available in menus/toolbar)
                    )  # Optional: the action icon (shows when in menus/toolbars) use numbers 1-255

                # Register the action
                idaapi.register_action(action_desc)
                idaapi.attach_action_to_menu(
                    'Edit/x64dbgida/',
                    'my:aboutaction',
                    idaapi.SETMENU_APP)

                action_desc = idaapi.action_desc_t(
                    'my:eksportaction',
                    'Export x64dbg database',
                    EksportHandler(),
                    '',
                    'Export x64dbg database',
                    )

                # Register the action
                idaapi.register_action(action_desc)
                idaapi.attach_action_to_menu(
                    'Edit/x64dbgida/',
                    'my:eksportaction',
                    idaapi.SETMENU_APP)

                action_desc = idaapi.action_desc_t(
                    'my:importaction',
                    'Import (uncompressed) database',
                    ImportHandler(),
                    '',
                    'Import (uncompressed) database',
                    )

                # Register the action
                idaapi.register_action(action_desc)
                idaapi.attach_action_to_menu(
                    'Edit/x64dbgida/',
                    'my:importaction',
                    idaapi.SETMENU_APP)

            else:
                print("Use version 1.0")

        return idaapi.PLUGIN_KEEP 
Example #28
Source Project: mkYARA   Author: fox-it   File: mkyara_plugin.py    License: GNU General Public License v3.0 4 votes vote down vote up
def init(self):
        loose_yara_action = idaapi.action_desc_t(
            'mkYARA:generate_loose_yara',   # The action name. This acts like an ID and must be unique
            'Generate Loose Yara Rule ',  # The action text.
            generic_handler(lambda: self.generate_yara_rule("loose")),   # The action handler.
            None,      # Optional: the action shortcut
            'Generate loose yara rule',  # Optional: the action tooltip (available in menus/toolbar)
            199  # Optional: the action icon (shows when in menus/toolbars)
        )

        normal_yara_action = idaapi.action_desc_t(
            'mkYARA:generate_normal_yara',   # The action name. This acts like an ID and must be unique
            'Generate Normal Yara Rule ',  # The action text.
            generic_handler(lambda: self.generate_yara_rule("normal")),   # The action handler.
            'Ctrl+Y',      # Optional: the action shortcut
            'Generate normal yara rule',  # Optional: the action tooltip (available in menus/toolbar)
            199  # Optional: the action icon (shows when in menus/toolbars)
        )

        strict_yara_action = idaapi.action_desc_t(
            'mkYARA:generate_strict_yara',   # The action name. This acts like an ID and must be unique
            'Generate Strict Yara Rule ',  # The action text.
            generic_handler(lambda: self.generate_yara_rule("strict")),   # The action handler.
            None,      # Optional: the action shortcut
            'Generate strict yara rule',  # Optional: the action tooltip (available in menus/toolbar)
            199  # Optional: the action icon (shows when in menus/toolbars)
        )

        data_yara_action = idaapi.action_desc_t(
            'mkYARA:generate_data_yara',   # The action name. This acts like an ID and must be unique
            'Generate Data Yara Rule ',  # The action text.
            generic_handler(lambda: self.generate_yara_rule("normal", is_data=True)),   # The action handler.
            None,      # Optional: the action shortcut
            'Generate data yara rule',  # Optional: the action tooltip (available in menus/toolbar)
            199  # Optional: the action icon (shows when in menus/toolbars)
        )

        idaapi.register_action(loose_yara_action)
        idaapi.register_action(normal_yara_action)
        idaapi.register_action(strict_yara_action)
        idaapi.register_action(data_yara_action)
        self.ui_hooks = mkYARAUIHooks()
        self.ui_hooks.hook()
        print('mkYARA :: Plugin Started')
        return idaapi.PLUGIN_KEEP