当前位置: 首页>>代码示例>>Python>>正文


Python ida_kernwin.register_action方法代码示例

本文整理汇总了Python中ida_kernwin.register_action方法的典型用法代码示例。如果您正苦于以下问题:Python ida_kernwin.register_action方法的具体用法?Python ida_kernwin.register_action怎么用?Python ida_kernwin.register_action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ida_kernwin的用法示例。


在下文中一共展示了ida_kernwin.register_action方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: editor_menuaction

# 需要导入模块: import ida_kernwin [as 别名]
# 或者: from ida_kernwin import register_action [as 别名]
def editor_menuaction(self):
        action_desc = ida_kernwin.action_desc_t(
            'my:editoraction',  # The action name. This acts like an ID and must be unique
            'Python Editor!',  # The action text.
            MyEditorHandler(),  # The action handler.
            'Ctrl+H',  # Optional: the action shortcut DO IT  HERE!
            'Script editor',  # Optional: the action tooltip (available in menus/toolbar)
            ida_kernwin.load_custom_icon(":/ico/python.png")  # hackish load action icon , if no custom icon use number from 1-150 from internal ida
        )

        # 3) Register the action
        ida_kernwin.register_action(action_desc)

        ida_kernwin.attach_action_to_menu(
            'Edit/Editor...',  # The relative path of where to add the action
            'my:editoraction',  # The action ID (see above)
            ida_kernwin.SETMENU_APP)  # We want to append the action after the 'Manual instruction...

        form = ida_kernwin.get_current_tform()
        ida_kernwin.attach_action_to_popup(form, None, "my:editoraction", None) 
开发者ID:techbliss,项目名称:Python_editor,代码行数:22,代码来源:Python_editor.py

示例2: init_hooks

# 需要导入模块: import ida_kernwin [as 别名]
# 或者: from ida_kernwin import register_action [as 别名]
def init_hooks(idausr):
    _setter = IdausrTemporarySetter(idausr)

    class ActionHandler(ida_kernwin.action_handler_t):
        def __init__(self, handler):
            ida_kernwin.action_handler_t.__init__(self)
            self.handler = handler

        def activate(self, ctx):
            with _setter:
                self.handler()

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

    for name, label, handler, before in _HOOKS:
        if ida_kernwin.unregister_action(name):
            action = ida_kernwin.action_desc_t(name, label, ActionHandler(handler))
            ida_kernwin.register_action(action)
            ida_kernwin.attach_action_to_menu(before, name, ida_kernwin.SETMENU_INS) 
开发者ID:Jinmo,项目名称:idapkg,代码行数:22,代码来源:hooks.py

示例3: main

# 需要导入模块: import ida_kernwin [as 别名]
# 或者: from ida_kernwin import register_action [as 别名]
def main():
    show_banner()

    print "Unregistering old action..."
    ida_kernwin.unregister_action(ACTION_NAME)

    if ida_hexrays.init_hexrays_plugin():
        ida_kernwin.register_action(
            ida_kernwin.action_desc_t(
                ACTION_NAME,
                "Keep sanity (stack strings)",
                stack_strings_ah_t(),
                None))

        print "Registered new action"

        idaapi.install_hexrays_callback(cb)

    else:
        print "[x] No decompiler found!"
        return 
开发者ID:fireeye,项目名称:flare-ida,代码行数:23,代码来源:stack_strings_helper.py

示例4: install

# 需要导入模块: import ida_kernwin [as 别名]
# 或者: from ida_kernwin import register_action [as 别名]
def install(self):
        action_name = self.__class__.__name__

        # Read and load the icon file
        icon_data = open(self._icon, "rb").read()
        self._icon_id = ida_kernwin.load_custom_icon(data=icon_data)

        # Create the action descriptor
        action_desc = ida_kernwin.action_desc_t(
            self._ACTION_ID,
            self._text,
            self._handler,
            None,
            self._tooltip,
            self._icon_id,
        )

        # Register the action using its descriptor
        result = ida_kernwin.register_action(action_desc)
        if not result:
            raise RuntimeError("Failed to register action %s" % action_name)

        # Attach the action to the chosen menu
        result = ida_kernwin.attach_action_to_menu(
            self._menu, self._ACTION_ID, ida_kernwin.SETMENU_APP
        )
        if not result:
            action_name = self.__class__.__name__
            raise RuntimeError("Failed to install action %s" % action_name)

        self._plugin.logger.debug("Installed action %s" % action_name)
        return True 
开发者ID:IDArlingTeam,项目名称:IDArling,代码行数:34,代码来源:actions.py

示例5: register

# 需要导入模块: import ida_kernwin [as 别名]
# 或者: from ida_kernwin import register_action [as 别名]
def register(self):
    r = ida_kernwin.register_action(self.get_desc())
    if not r:
      log('actions').warning("failed registering %s: %s", self, r)
      return
    ida_kernwin.attach_action_to_menu(
        self.get_action_path(),
        self.get_id(),
        ida_kernwin.SETMENU_APP)
    r = ida_kernwin.attach_action_to_toolbar(
        "AnalysisToolBar",
        self.get_id())
    if not r:
      log('actions').warn("registration of %s failed: %s", self, r) 
开发者ID:nirizr,项目名称:rematch,代码行数:16,代码来源:base.py

示例6: register_action

# 需要导入模块: import ida_kernwin [as 别名]
# 或者: from ida_kernwin import register_action [as 别名]
def register_action(name, shortcut=''):
    def handler(f):
        # 1) Create the handler class
        class MyHandler(ida_kernwin.action_handler_t):
            def __init__(self):
                ida_kernwin.action_handler_t.__init__(self)

            # Say hello when invoked.
            def activate(self, ctx):
                t = threading.Thread(target=f)
                t.start()
                return 1

            # This action is always available.
            def update(self, ctx):
                return ida_kernwin.AST_ENABLE_ALWAYS

        # 2) Describe the action
        action_desc = ida_kernwin.action_desc_t(
            name,  # The action name. This acts like an ID and must be unique
            name,  # The action text.
            MyHandler(),  # The action handler.
            shortcut,  # Optional: the action shortcut
            name,  # Optional: the action tooltip (available in menus/toolbar)
            0)  # Optional: the action icon (shows when in menus/toolbars)

        # 3) Register the action
        ida_kernwin.register_action(action_desc)
        return f

    return handler 
开发者ID:Jinmo,项目名称:idapkg,代码行数:33,代码来源:util.py


注:本文中的ida_kernwin.register_action方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。