Python idaapi 模块,init_hexrays_plugin() 实例源码

我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用idaapi.init_hexrays_plugin()

项目:ida-batch_decompile    作者:tintinweb    | 项目源码 | 文件源码
def __init__(self):
        self.is_windows = sys.platform.startswith('win')
        self.is_ida64 = GetIdbPath().endswith(".i64")  # hackhackhack - check if we're ida64 or ida32
        logger.debug("[+] is_windows: %r" % self.is_windows)
        logger.debug("[+] is_ida64: %r" % self.is_ida64)
        self.my_path = os.path.abspath(__file__)
        self.temp_path = None
        self._init_target()
        # settings (form)
        # todo: load from configfile if available.
        self.output_path = None
        self.chk_annotate_stackvar_size = False
        self.chk_annotate_xrefs = False
        self.chk_decompile_imports = False
        self.chk_decompile_imports_recursive = False
        self.chk_decompile_alternative = False
        # self.ida_home = idaapi.idadir(".")
        self.ida_home = GetIdaDirectory()
        # wait for ida analysis to finish
        self.wait_for_analysis_to_finish()
        if not idaapi.init_hexrays_plugin():
            logger.warning("forcing hexrays to load...")
            self.load_plugin_decompiler()
        if not idaapi.init_hexrays_plugin():
            raise Exception("hexrays decompiler is not available :(")
项目:bap-ida-python    作者:BinaryAnalysisPlatform    | 项目源码 | 文件源码
def init(self):
        """
        Ensure plugin's line modification function is called whenever needed.

        If Hex-Rays is not installed, or is not initialized yet, then plugin
        will not load. To ensure that the plugin loads after Hex-Rays, please
        name your plugin's .py file with a name that starts lexicographically
        after "hexx86f"
        """
        try:
            if idaapi.init_hexrays_plugin():
                def hexrays_event_callback(event, *args):
                    if event == idaapi.hxe_refresh_pseudocode:
                        # We use this event instead of hxe_text_ready because
                        #   MacOSX doesn't seem to work well with it
                        # TODO: Look into this
                        vu, = args
                        self.visit_func(vu.cfunc)
                    return 0
                idaapi.install_hexrays_callback(hexrays_event_callback)
            else:
                return idaapi.PLUGIN_SKIP
        except AttributeError:
            idc.Warning('''init_hexrays_plugin() not found.
            Skipping Hex-Rays plugin.''')
        return idaapi.PLUGIN_KEEP
项目:prefix    作者:gaasedelen    | 项目源码 | 文件源码
def _init_hexrays_hooks(self):
        """
        Install Hex-Rrays hooks (when available).

        NOTE: This is called when the ui_ready_to_run event fires.
        """
        if idaapi.init_hexrays_plugin():
            idaapi.install_hexrays_callback(self._hooks.hxe_callback)

    #--------------------------------------------------------------------------
    # IDA Actions
    #--------------------------------------------------------------------------
项目:lighthouse    作者:gaasedelen    | 项目源码 | 文件源码
def _init_hexrays_hooks(self):
        """
        Install Hex-Rrays hooks (when available).
        """
        result = False

        if idaapi.init_hexrays_plugin():
            logger.debug("HexRays present, installing hooks...")
            result = idaapi.install_hexrays_callback(self._hxe_callback)

        logger.debug("HexRays hooked: %r" % result)

    #------------------------------------------------------------------------------
    # Painting
    #------------------------------------------------------------------------------
项目:HexRaysPyTools    作者:igogo-x86    | 项目源码 | 文件源码
def init():
        if not idaapi.init_hexrays_plugin():
            print "[ERROR] Failed to initialize Hex-Rays SDK"
            return idaapi.PLUGIN_SKIP

        Helper.temporary_structure = TemporaryStructureModel()
        # Actions.register(Actions.CreateVtable)
        Actions.register(Actions.ShowGraph)
        Actions.register(Actions.ShowClasses)
        Actions.register(Actions.GetStructureBySize)
        Actions.register(Actions.RemoveArgument)
        Actions.register(Actions.AddRemoveReturn)
        Actions.register(Actions.ConvertToUsercall)
        Actions.register(Actions.ShallowScanVariable, Helper.temporary_structure)
        Actions.register(Actions.DeepScanVariable, Helper.temporary_structure)
        Actions.register(Actions.DeepScanReturn, Helper.temporary_structure)
        Actions.register(Actions.DeepScanFunctions, Helper.temporary_structure)
        Actions.register(Actions.RecognizeShape)
        Actions.register(Actions.CreateNewField)
        Actions.register(Actions.SelectContainingStructure, potential_negatives)
        Actions.register(Actions.ResetContainingStructure)
        Actions.register(Actions.RecastItemRight)
        Actions.register(Actions.RecastItemLeft)
        Actions.register(Actions.RenameOther)
        Actions.register(Actions.RenameInside)
        Actions.register(Actions.RenameOutside)
        Actions.register(Actions.SwapThenElse)

        idaapi.attach_action_to_menu('View/Open subviews/Local types', Actions.ShowClasses.name, idaapi.SETMENU_APP)
        idaapi.install_hexrays_callback(hexrays_events_callback)

        Helper.touched_functions.clear()
        Const.init()

        return idaapi.PLUGIN_KEEP
项目:ida_func_ptr    作者:HandsomeMatt    | 项目源码 | 文件源码
def init(self):
        # just go when we have hexrays
        if not idaapi.init_hexrays_plugin():
            return idaapi.PLUGIN_SKIP

        # initialize the menu actions our plugin will inject
        self._init_action_bulk()
        self._init_action_copy()

        # initialize plugin hooks
        self._init_hooks()

        # done
        idaapi.msg("%s %s initialized...\n" % (self.wanted_name, VERSION))
        return idaapi.PLUGIN_KEEP
项目:ida_func_ptr    作者:HandsomeMatt    | 项目源码 | 文件源码
def _init_hooks(self):
        self._hooks = Hooks()
        self._hooks.hook()

        if not idaapi.init_hexrays_plugin():
            idaapi.msg("[ERROR] Failed to initialize Hex-Rays SDK")
        else:
            idaapi.install_hexrays_callback(self._hooks.hxe_callback)

    #--------------------------------------------------------------------------
    # IDA Actions
    #--------------------------------------------------------------------------
项目:devirtualize    作者:ALSchwalm    | 项目源码 | 文件源码
def init(self):
        idaapi.msg('devirtualize_plugin:init\n')
        if not idaapi.init_hexrays_plugin():
            idaapi.msg('No decompiler. Skipping\n')
            return idaapi.PLUGIN_SKIP
        return idaapi.PLUGIN_OK