Python idaapi.init_hexrays_plugin() Examples

The following are 6 code examples for showing how to use idaapi.init_hexrays_plugin(). These examples are extracted from open source projects. 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 check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module idaapi , or try the search function .

Example 1
Project: lighthouse   Author: gaasedelen   File:    License: MIT License 6 votes vote down vote up
def _notify_status_changed(self, status):

        # enable / disable hook based on the painter being enabled or disabled
        if status:
            if idaapi.init_hexrays_plugin():
            if idaapi.init_hexrays_plugin():

        # send the status changed signal...
        super(IDAPainter, self)._notify_status_changed(status)

    # Paint Actions
Example 2
Project: ida-batch_decompile   Author: tintinweb   File:    License: GNU General Public License v3.0 6 votes vote down vote up
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
        # 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
        if not idaapi.init_hexrays_plugin():
            logger.warning("forcing hexrays to load...")
        if not idaapi.init_hexrays_plugin():
            raise Exception("hexrays decompiler is not available :(") 
Example 3
Project: prefix   Author: gaasedelen   File:    License: MIT License 5 votes vote down vote up
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():

    # IDA Actions
Example 4
Project: bap-ida-python   Author: BinaryAnalysisPlatform   File:    License: MIT License 5 votes vote down vote up
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"
            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
                    return 0
                return idaapi.PLUGIN_SKIP
        except AttributeError:
            idc.Warning('''init_hexrays_plugin() not found.
            Skipping Hex-Rays plugin.''')
        return idaapi.PLUGIN_KEEP 
Example 5
Project: flare-ida   Author: fireeye   File:    License: Apache License 2.0 5 votes vote down vote up
def main():
    if not idaapi.init_hexrays_plugin():
        return False

    print "Hex-rays version %s has been detected" % idaapi.get_hexrays_version()
Example 6
Project: hrdev   Author: ax330d   File:    License: MIT License 4 votes vote down vote up
def run(self):
        '''Start the plugin.'''

        if not idaapi.init_hexrays_plugin():
            print "HRDEV Error: Failed to initialise Hex-Rays plugin."

        function_name = idaapi.get_func_name(idaapi.get_screen_ea())
        demangled_name =

        src = idaapi.decompile(idaapi.get_screen_ea())

        file_name = '{}.cpp'.format(
        cache_path = os.path.sep.join([tempfile.gettempdir(),

        # Create required directories if they dont exist
        tmp_dir_path = os.path.sep.join([tempfile.gettempdir(), 'hrdev_cache'])
        if not os.path.isdir(tmp_dir_path):

        if not os.path.isdir(cache_path):

        complete_path = os.path.sep.join([cache_path, file_name])
        idaapi.msg("HRDEV cache path: {}\n".format(complete_path))

        # Check if file is already in cache
        if not os.path.isfile(complete_path) or \
           self.config_main.getboolean('etc', 'disable_cache'):
  , str(src))

        lvars = {}
        for v in src.lvars:
            _type = idaapi.print_tinfo('', 0, 0, idaapi.PRTYPE_1LINE, v.tif, '', '')
            lvars[str(] = "{} {} {}".\
                format(_type, str(, str(v.cmt))

        max_title = self.config_main.getint('etc', 'max_title')
        self.gui = hrdev_plugin.include.gui.Canvas(self.config_main,

        self.parser = hrdev_plugin.include.syntax.Parser(self, lvars)