我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用idaapi.PLUGIN_SKIP。
def init(self): """Read directory and load as many plugins as possible.""" import os import bap.plugins import bap.utils.run import idaapi idaapi.msg("BAP Loader activated\n") bap.utils.run.check_and_configure_bap() plugin_path = os.path.dirname(bap.plugins.__file__) idaapi.msg("Loading plugins from {}\n".format(plugin_path)) for plugin in sorted(os.listdir(plugin_path)): path = os.path.join(plugin_path, plugin) if not plugin.endswith('.py') or plugin.startswith('__'): continue # Skip non-plugins idaapi.load_plugin(path) return idaapi.PLUGIN_SKIP # The loader will be called whenever needed
def init(self): """ This is called by IDA when it is loading the plugin. """ # attempt plugin initialization try: self._install_plugin() # failed to initialize or integrate the plugin, log and skip loading except Exception as e: logger.exception("Failed to initialize") return idaapi.PLUGIN_SKIP # plugin loaded successfully, print the Lighthouse banner self.print_banner() logger.info("Successfully initialized") # tell IDA to keep the plugin loaded (everything is okay) return idaapi.PLUGIN_KEEP
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
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
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
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