Пример #1
0
def register_actions():
    action_desc = ida_kernwin.action_desc_t(
        'fakepdb_pdb_generation',  # The action name. This acts like an ID and must be unique
        'Generate .PDB file',  # The action text.
        __fakepdb_pdbgeneration_actionhandler(False),  # The action handler.
        'Ctrl+Shift+4',  # Optional: the action shortcut
        '',  # Optional: the action tooltip (available in menus/toolbar)
        0)  # Optional: the action icon (shows when in menus/toolbars)

    ida_kernwin.register_action(action_desc)
    ida_kernwin.attach_action_to_menu('Edit/FakePDB/',
                                      'fakepdb_pdb_generation',
                                      ida_kernwin.SETMENU_APP)

    action_desc = ida_kernwin.action_desc_t(
        'fakepdb_pdb_generation_labels',  # The action name. This acts like an ID and must be unique
        'Generate .PDB file (with function labels)',  # The action text.
        __fakepdb_pdbgeneration_actionhandler(True),  # The action handler.
        'Ctrl+Shift+5',  # Optional: the action shortcut
        '',  # Optional: the action tooltip (available in menus/toolbar)
        0)  # Optional: the action icon (shows when in menus/toolbars)

    ida_kernwin.register_action(action_desc)
    ida_kernwin.attach_action_to_menu('Edit/FakePDB/',
                                      'fakepdb_pdb_generation_labels',
                                      ida_kernwin.SETMENU_APP)
Пример #2
0
def main(): # type: () -> None
    if hr.init_hexrays_plugin():
        existing = ida_kernwin.unregister_action(ACTION_NAME)
        ida_kernwin.register_action(
            ida_kernwin.action_desc_t(ACTION_NAME, "sead::SafeString", sead_string_ah_t(), "F12"))
        if not existing:
            hr.install_hexrays_callback(cb)
Пример #3
0
    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
Пример #4
0
def register(action, *args):
    ida_kernwin.register_action(
        ida_kernwin.action_desc_t(
            action.name,
            action.description,
            action(*args),
            action.hotkey
        )
    )
Пример #5
0
 def init(self):
     # Register actions
     ida_kernwin.register_action(
         ida_kernwin.action_desc_t(
             ACTNAME_REFRESH, "Refresh", refresh_ah_t(self)))
     ida_kernwin.register_action(
         ida_kernwin.action_desc_t(
             ACTNAME_CLOSE, "Close", close_ah_t(self)))
     return ida_idaapi.PLUGIN_KEEP
Пример #6
0
Файл: vds3.py Проект: clayne/src
 def init(self):
     if ida_hexrays.init_hexrays_plugin():
         i = hexrays_callback_info()
         ida_kernwin.register_action(
             ida_kernwin.action_desc_t(inverter_actname, "Invert then/else",
                                       invert_action_handler_t(i), "I"))
         self.vds3_hooks = vds3_hooks_t(i)
         self.vds3_hooks.hook()
         return ida_idaapi.PLUGIN_KEEP  # keep us in the memory
Пример #7
0
Файл: vds5.py Проект: ylkcy/src
 def init(self):
     if ida_hexrays.init_hexrays_plugin():
         ida_kernwin.register_action(
             ida_kernwin.action_desc_t(ACTION_NAME,
                                       "Hex-Rays show C graph (IDAPython)",
                                       display_graph_ah_t(),
                                       ACTION_SHORTCUT))
         self.vds5_hooks = vds5_hooks_t()
         self.vds5_hooks.hook()
         return ida_idaapi.PLUGIN_KEEP  # keep us in the memory
Пример #8
0
 def init(self):
     export_action = ida_kernwin.action_desc_t('export-xref:export',
                                               'Export Xref...',
                                               export_handler_t())
     ida_kernwin.register_action(export_action)
     ida_kernwin.attach_action_to_menu('File/Produce file/',
                                       'export-xref:export',
                                       ida_kernwin.SETMENU_APP)
     print("[Export-Xref] Loaded")
     return ida_idaapi.PLUGIN_OK
Пример #9
0
 def init(self):
     if ida_hexrays.init_hexrays_plugin():
         print(
             "Hex-rays version %s has been detected, Structure offsets ready to use"
             % ida_hexrays.get_hexrays_version())
         ida_kernwin.register_action(
             ida_kernwin.action_desc_t("vds17:strchoose",
                                       "Structure offsets",
                                       func_stroff_ah_t(), "Shift+T"))
         return ida_idaapi.PLUGIN_KEEP  # keep us in the memory
Пример #10
0
def register_actions():
    action_desc = ida_kernwin.action_desc_t(
        'fakepdb_dumpinfo',                 # The action name. This acts like an ID and must be unique
        'Dump info to .json',               # The action text.
        __fakepdb_dumpinfo_actionhandler(), # The action handler.
        'Ctrl+Shift+1',                     # Optional: the action shortcut
        '',                                 # Optional: the action tooltip (available in menus/toolbar)
        0)                                  # Optional: the action icon (shows when in menus/toolbars)

    ida_kernwin.register_action(action_desc)
    ida_kernwin.attach_action_to_menu('Edit/FakePDB/', 'fakepdb_dumpinfo', ida_kernwin.SETMENU_APP)
Пример #11
0
    def init(self):
        self.vds5_hooks = None
        if not ida_hexrays.init_hexrays_plugin():
            idaapi.msg("hexrays-graph: hexrays is not available.")
            return idaapi.PLUGIN_SKIP

        ida_kernwin.register_action(
            ida_kernwin.action_desc_t(ACTION_NAME,
                                      "Hex-Rays show C graph (IDAPython)",
                                      display_graph_ah_t(), ACTION_SHORTCUT))
        self.vds5_hooks = vds5_hooks_t()
        self.vds5_hooks.hook()
        return idaapi.PLUGIN_KEEP
Пример #12
0
Файл: xray.py Проект: neoni/xray
    def init(self):
        self.xray_hooks = None
        if not is_compatible():
            kw.msg("%s: decompiler not available, skipping." % PLUGIN_NAME)
            return ida_idaapi.PLUGIN_SKIP

        load_cfg()

        kw.register_action(
            kw.action_desc_t(XRAY_LOADCFG_ACTION_ID,
                             "%s: reload config" % PLUGIN_NAME,
                             loadcfg_action_handler_t(), "Ctrl-R"))

        kw.register_action(
            kw.action_desc_t(XRAY_FILTER_ACTION_ID, "%s: toggle" % PLUGIN_NAME,
                             xray_action_handler_t(), "F3"))

        kw.register_action(
            kw.action_desc_t(XRAY_QUERY_ACTION_ID, "%s: search" % PLUGIN_NAME,
                             regexfilter_action_handler_t(), "Ctrl-F"))

        kw.register_action(
            kw.action_desc_t(XRAY_COLOR_ACTION_ID, "%s: color" % PLUGIN_NAME,
                             color_action_handler_t(), "Alt-Q"))

        self.xray_hooks = xray_hooks_t()
        self.xray_hooks.hook()
        return ida_idaapi.PLUGIN_KEEP
    def install(self):
        """
        Install the action into the IDA UI.

        :return: did the install succeed
        """
        # Read and load the icon file
        iconData = str(open(self._icon, 'rb').read())
        self._iconId = ida_kernwin.load_custom_icon(data=iconData)

        # Create the action description
        actionDesc = ida_kernwin.action_desc_t(self._ACTION_ID, self._text,
                                               self._handler, None,
                                               self._tooltip, self._iconId)

        # Register the action using its description
        result = ida_kernwin.register_action(actionDesc)
        if not result:
            raise RuntimeError("Failed to register action")

        # 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:
            raise RuntimeError("Failed to attach action")

        logger.debug("Installed the action")
        return True
Пример #14
0
    def install(self):
        action_name = self.__class__.__name__

        # Read and load the icon file
        icon_data = str(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
Пример #15
0
def add_action(action):
    """
    Add an ida-action
    :param action: action given as the `Action` namedtuple
    :return: None
    """
    class Handler(ida_kernwin.action_handler_t):
        def __init__(self):
            ida_kernwin.action_handler_t.__init__(self)

        def activate(self, ctx):
            action.handler()
            return 1

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

    act_icon = -1
    if action.icon_filename:
        icon_full_filename = \
            pkg_resources.resource_filename('fa',
                                            os.path.join(
                                                'res',
                                                'icons',
                                                action.icon_filename))
        with open(icon_full_filename, 'rb') as f:
            icon_data = f.read()
        act_icon = ida_kernwin.load_custom_icon(data=icon_data, format="png")

    act_name = action.name

    ida_kernwin.unregister_action(act_name)
    if ida_kernwin.register_action(ida_kernwin.action_desc_t(
            act_name,  # Name. Acts as an ID. Must be unique.
            action.label,  # Label. That's what users see.
            Handler(),  # Handler. Called when activated, and for updating
            action.hotkey,  # Shortcut (optional)
            None,  # Tooltip (optional)
            act_icon)):  # Icon ID (optional)

        # Insert the action in the menu
        if not ida_kernwin.attach_action_to_menu(
                "FA/", act_name, ida_kernwin.SETMENU_APP):
            print("Failed attaching to menu.")

        # Insert the action in a toolbar
        if not ida_kernwin.attach_action_to_toolbar("fa", act_name):
            print("Failed attaching to toolbar.")

        class Hooks(ida_kernwin.UI_Hooks):
            def finish_populating_widget_popup(self, widget, popup):
                if ida_kernwin.get_widget_type(widget) == \
                        ida_kernwin.BWN_DISASM:
                    ida_kernwin.attach_action_to_popup(widget,
                                                       popup,
                                                       act_name,
                                                       None)

        hooks = Hooks()
        hooks.hook()
Пример #16
0
    def _install_load_trace(self):

        # TODO: 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 = ida_kernwin.load_custom_icon(data=icon_data)

        # describe a custom IDA UI action
        action_desc = ida_kernwin.action_desc_t(
            self.ACTION_LOAD_TRACE,  # The action name
            "~T~enet trace file...",  # The action text
            IDACtxEntry(self._interactive_load_trace),  # The action handler
            None,  # Optional: action shortcut
            "Load a Tenet trace file",  # Optional: tooltip
            -1  # Optional: the action icon
        )

        # register the action with IDA
        result = ida_kernwin.register_action(action_desc)
        assert result, f"Failed to register '{action_desc.name}' action with IDA"

        # attach the action to the File-> dropdown menu
        result = ida_kernwin.attach_action_to_menu(
            "File/Load file/",  # Relative path of where to add the action
            self.ACTION_LOAD_TRACE,  # The action ID (see above)
            ida_kernwin.SETMENU_APP  # We want to append the action after ^
        )
        assert result, f"Failed action attach {action_desc.name}"

        logger.info(f"Installed the '{action_desc.name}' menu entry")
Пример #17
0
 def _register_action(self, hotkey, desc):
     actname = HRDevHelper.get_action_name(desc)
     print(actname)
     if ida_kernwin.register_action(
             ida_kernwin.action_desc_t(actname, desc, hotkey_handler_t(),
                                       hotkey, None, -1)):
         self._registered_actions[actname] = (desc, hotkey)
     else:
         ida_kernwin.warning("%s: failed registering action" % PLUGIN_NAME)
Пример #18
0
def ApiPtrTypeSetInstall():
    if ida_hexrays.init_hexrays_plugin():
        ra = ida_kernwin.register_action(
            ida_kernwin.action_desc_t(API_TYPE_ACTION_NAME,
                                      API_TYPE_ACTION_DESC,
                                      api_ptr_type_setter(),
                                      API_TYPE_ACTION_SHORTCUT))

    else:
        print("API * type setter: hexrays is not available.")
Пример #19
0
    def init(self):
        self.xray_hooks = None
        if is_compatible():
            load_cfg()

            kw.register_action(
                kw.action_desc_t(XRAY_LOADCFG_AID,
                                 "%s: reload config" % PLUGIN_NAME,
                                 loadcfg_action_handler_t(), "Ctrl-r"))

            kw.register_action(
                kw.action_desc_t(XRAY_FILTER_AID, "%s: toggle" % PLUGIN_NAME,
                                 xray_action_handler_t(), "F3"))

            self.xray_hooks = xray_hooks_t()
            self.xray_hooks.hook()
            return ida_idaapi.PLUGIN_KEEP

        return ida_idaapi.PLUGIN_SKIP
Пример #20
0
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
Пример #21
0
    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...

        ida_kernwin.get_current_widget()
        ida_kernwin.attach_action_to_popup(form, None, "my:editoraction", None)
Пример #22
0
def register_open_action():
    """
    Provide the action that will create the widget
    when the user asks for it.
    """
    class create_widget_t(ida_kernwin.action_handler_t):
        def activate(self, ctx):
            if ida_kernwin.find_widget(title) is None:
                global auto_inst
                auto_inst = auto_inst_t()
                assert (auto_inst.Create())
                assert (auto_inst.Show())

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

    action_name = "autoinst:create"
    ida_kernwin.register_action(
        ida_kernwin.action_desc_t(action_name, title, create_widget_t()))
    ida_kernwin.attach_action_to_menu("View/Open subviews/Strings",
                                      action_name, ida_kernwin.SETMENU_APP)
Пример #23
0
 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)
Пример #24
0
    def finish_populating_widget_popup(self, widget, popup):
        widget_type = idaapi.get_widget_type(widget)
        if ((idaapi.BWN_FUNCS == widget_type) and self.taintinfo.showing_taint()):
            # about to show context menu for "Functions window" - as taint is
            # shown, add item to show window of tainted functions
            ida_kernwin.unregister_action(ShowTaintedFuncs.ACTION_NAME)

            # could also provide a shortcut and icon in the action_desc_t, if helpful
            if ida_kernwin.register_action(
                ida_kernwin.action_desc_t(
                    ShowTaintedFuncs.ACTION_NAME,
                    ShowTaintedFuncs.ACTION_LABEL,
                    ShowTaintedFuncs(self.taintinfo),
                    None,
                    ShowTaintedFuncs.ACTION_TOOLTIP)):
                    # if middle arg is None, this item is added permanently to the popup menu
                    # if it lists a TPopupMenu* handle, then this action is added just for this invocation
                    ida_kernwin.attach_action_to_popup(widget, popup, ShowTaintedFuncs.ACTION_NAME)
        elif ((idaapi.BWN_DISASM == widget_type) and self.taintinfo.have_taint_info()):
            # about to show context menu for a disassembly window - as taint
            # information is available, add either a Show or Hide item
            ida_kernwin.unregister_action(ShowHideTaint.ACTION_NAME)
            if (self.taintinfo.showing_taint()):
                if ida_kernwin.register_action(
                    ida_kernwin.action_desc_t(
                        ShowHideTaint.ACTION_NAME,
                        ShowHideTaint.HIDE_ACTION_LABEL,
                        ShowHideTaint(self.taintinfo),
                        None,
                        ShowHideTaint.HIDE_ACTION_TOOLTIP)):
                        ida_kernwin.attach_action_to_popup(widget, popup, ShowHideTaint.ACTION_NAME)
            else:
                if ida_kernwin.register_action(
                    ida_kernwin.action_desc_t(
                        ShowHideTaint.ACTION_NAME,
                        ShowHideTaint.SHOW_ACTION_LABEL,
                        ShowHideTaint(self.taintinfo),
                        None,
                        ShowHideTaint.SHOW_ACTION_TOOLTIP)):
                        ida_kernwin.attach_action_to_popup(widget, popup, ShowHideTaint.ACTION_NAME)
Пример #25
0
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)
Пример #26
0
    def _init_actions(self):
        action = ida_kernwin.action_desc_t(self.act_static,
                                           'static analyzer: main menu',
                                           FEStaticAnalyzer(), 'Ctrl+Shift+s',
                                           '静态分析器主菜单', 0)
        ida_kernwin.register_action(action)
        ida_kernwin.attach_action_to_menu(MENU_PATH, self.act_static,
                                          ida_kernwin.SETMENU_APP)

        action = ida_kernwin.action_desc_t(
            self.act_dbg_hook, 'dynamic analyzer: enable/disable debug hook',
            FEDynamicAnalyzer(), 'Ctrl+Shift+d', '启用/解除DEBUG Hook', 0)
        ida_kernwin.register_action(action)
        ida_kernwin.attach_action_to_menu(MENU_PATH, self.act_dbg_hook,
                                          ida_kernwin.SETMENU_APP)

        action = ida_kernwin.action_desc_t(self.act_pattern,
                                           'code pattern: find code pattern',
                                           FECodePattern(), 'Ctrl+Shift+c',
                                           '代码模式扫描', 0)
        ida_kernwin.register_action(action)
        ida_kernwin.attach_action_to_menu(MENU_PATH, self.act_pattern,
                                          ida_kernwin.SETMENU_APP)

        action = ida_kernwin.action_desc_t(self.act_test,
                                           'reverse assist tools',
                                           FEReAssist(), 'Ctrl+Shift+x',
                                           '逆向辅助工具', 0)
        ida_kernwin.register_action(action)
        ida_kernwin.attach_action_to_menu(MENU_PATH, self.act_assist,
                                          ida_kernwin.SETMENU_APP)

        action = ida_kernwin.action_desc_t(self.act_test, 'functional test',
                                           FEFuncTest(), 'Ctrl+Shift+q',
                                           '功能性测试', 0)
        ida_kernwin.register_action(action)
        ida_kernwin.attach_action_to_menu(MENU_PATH, self.act_test,
                                          ida_kernwin.SETMENU_APP)
Пример #27
0
 def registerAction(self):
     action_desc = ida_kernwin.action_desc_t(
         self.id,
         self.name,
         self,
         self.shortcut,
         self.tooltip,
         0
     )
     if not ida_kernwin.register_action(action_desc):
         return False
     if not ida_kernwin.attach_action_to_menu(self.menuPath, self.id, 0):
         return False
     return True
Пример #28
0
	def init(self):
		import_action = ida_kernwin.action_desc_t(
			'idasync:import',
			'IDA-Sync JSON file...',
			ImportHandler())
		export_action = ida_kernwin.action_desc_t(
			'idasync:export',
			'Create IDA-Sync JSON file...',
			ExportHandler())
		ida_kernwin.register_action(import_action)
		ida_kernwin.register_action(export_action)
		ida_kernwin.attach_action_to_menu(
			'File/Load file/Parse C header file...',
			'idasync:import',
			ida_kernwin.SETMENU_APP
		)
		ida_kernwin.attach_action_to_menu(
			'File/Produce file/Create C header file...',
			'idasync:export',
			ida_kernwin.SETMENU_APP
		)
		print("[IDA-Sync] Loaded")
		return ida_idaapi.PLUGIN_OK
Пример #29
0
    def _install_final_execution(self):

        # describe a custom IDA UI action
        action_desc = ida_kernwin.action_desc_t(
            self.ACTION_FINAL_EXECUTION,  # The action name
            "Go to final execution",  # The action text
            IDACtxEntry(
                self._interactive_final_execution),  # The action handler
            None,  # Optional: action shortcut
            "Go to the final execution of the current address",  # Optional: tooltip
            -1  # Optional: the action icon
        )

        # register the action with IDA
        result = ida_kernwin.register_action(action_desc)
        assert result, f"Failed to register '{action_desc.name}' action with IDA"
        logger.info(f"Installed the '{action_desc.name}' menu entry")
Пример #30
0
    def _init_action_view_microcode(self):
        """
        Register the 'View microcode' action with IDA.
        """

        # describe the action
        action_desc = ida_kernwin.action_desc_t(
            self.ACTION_VIEW_MICROCODE,  # The action name
            "View microcode",  # The action text
            IDACtxEntry(self.interactive_view_microcode),  # The action handler
            "Ctrl-Shift-M",  # Optional: action shortcut
            "Open the Lucid Microcode Explorer",  # Optional: tooltip
            -1  # Optional: the action icon
        )

        # register the action with IDA
        assert ida_kernwin.register_action(
            action_desc), "Action registration failed"
Пример #31
0
    args = convert_args_to_long(xref_args)
    if args:
        try:
            key = idaapi.get_many_bytes(args[2], args[3] if idc.Dword(args[3]) == 0xffffffff else idc.Dword(args[3]))
            data = idaapi.get_many_bytes(args[0], args[1] if idc.Dword(args[1]) == 0xffffffff else idc.Dword(args[1]))
        except TypeError:
            print("Couldn't retrieve the cipher or the key.")
            print(xref_args)
        else:
            key = null_pad(key, 0x20)
            if args[4] == 1:
                data = custom_b64decode(data)
            plain = PKCS7_unpad(AES.new(key, AES.MODE_CBC, "\x00"*16).decrypt(data))
            #add_comment(cfunc, plain, xref)
            print(plain)
    else:
        print("Not all args are numbers")
        print(xref_args)

CUSTOM_B64_ALPHA = "IJKLMNOPABCDEFGHQRSTUVWXghijklmnYZabcdefopqrstuv456789+/wxyz0123"
ACTION_NAME = "extract-decrypt-arguments-var-prop"
ida_kernwin.unregister_action(ACTION_NAME)
if idaapi.init_hexrays_plugin():
    ida_kernwin.register_action(ida_kernwin.action_desc_t(ACTION_NAME, "Extract and decrypt arguments", extract_args_t(decrypt_data, True), None))
class popup_hooks_t(ida_kernwin.UI_Hooks):
    def finish_populating_widget_popup(self, w, popup):
        if ida_kernwin.get_widget_type(w) == ida_kernwin.BWN_FUNCS:
            ida_kernwin.attach_action_to_popup(w, popup, ACTION_NAME, None)
hooks = popup_hooks_t()
hooks.hook()
Пример #32
0
class newcmd_dbgcmd_ah_t(base_dbgcmd_ah_t):
    def activate(self, ctx):
        dbgcmd.IssueCommand()

# -----------------------------------------------------------------------
class close_dbgcmd_ah_t(base_dbgcmd_ah_t):
    def activate(self, ctx):
        dbgcmd.Close()

# -----------------------------------------------------------------------
# Register actions (if needed)
ACTNAME_CLEAR = "dbgcmd:clear"
ACTNAME_NEWCMD = "dbgcmd:newcmd"
ACTNAME_CLOSE = "dbgcmd:close"
ida_kernwin.register_action(
    ida_kernwin.action_desc_t(
        ACTNAME_CLEAR, "Clear", clear_dbgcmd_ah_t(), "x"))
ida_kernwin.register_action(
    ida_kernwin.action_desc_t(
        ACTNAME_NEWCMD, "New command", newcmd_dbgcmd_ah_t(), "Insert"))
ida_kernwin.register_action(
    ida_kernwin.action_desc_t(
        ACTNAME_CLOSE, "Close", close_dbgcmd_ah_t(), "Escape"))

# -----------------------------------------------------------------------
class dbgcmd_t(ida_kernwin.simplecustviewer_t):
    def Create(self):
        # Form the title
        title = "Debugger command window"
        # Create the customview
        if not ida_kernwin.simplecustviewer_t.Create(self, title):
Пример #33
0
# --------------------------------------------------------------------------
class my_hooks_t(ida_kernwin.UI_Hooks):
    def __init__(self):
        ida_kernwin.UI_Hooks.__init__(self)

    def populating_widget_popup(self, widget, popup):
        if ida_kernwin.get_widget_type(widget) == ida_kernwin.BWN_PSEUDOCODE:
            ida_kernwin.attach_action_to_popup(widget, popup, ACTION_NAME)
my_hooks = my_hooks_t()
my_hooks.hook()


# --------------------------------------------------------------------------
SVC_EXIT       = 0x900001
SVC_EXIT_GROUP = 0x9000f8

if ida_hexrays.init_hexrays_plugin():
    udc_exit = udc_exit_t(SVC_EXIT, "svc_exit")
    udc_exit.toggle_install()

    udc_exit_group = udc_exit_t(SVC_EXIT_GROUP, "svc_exit_group")
    udc_exit_group.toggle_install()

    ida_kernwin.register_action(
        ida_kernwin.action_desc_t(
            ACTION_NAME,
            "vds8.py:Toggle UDC",
            toggle_udc_ah_t(),
            ACTION_SHORTCUT))

Пример #34
0
        import tempfile
        fname = tempfile.mktemp(suffix=".gdl")
        cg.gen_gdl(fname)
        ida_gdl.display_gdl(fname)
        return 1

    def update(self, ctx):
        return ida_kernwin.AST_ENABLE_FOR_WIDGET if \
            ctx.widget_type == ida_kernwin.BWN_PSEUDOCODE else \
            ida_kernwin.AST_DISABLE_FOR_WIDGET


class vds5_hooks_t(ida_hexrays.Hexrays_Hooks):
    def populating_popup(self, widget, handle, vu):
        idaapi.attach_action_to_popup(vu.ct, None, ACTION_NAME)
        return 0

if ida_hexrays.init_hexrays_plugin():
    ida_kernwin.register_action(
        ida_kernwin.action_desc_t(
            ACTION_NAME,
            "Hex-Rays show C graph (IDAPython)",
            display_graph_ah_t(),
            ACTION_SHORTCUT))
    vds5_hooks = vds5_hooks_t()
    vds5_hooks.hook()
else:
    print('hexrays-graph: hexrays is not available.')