def add_menu_item_helper(self, name, text, tooltip, icon, shortcut): description = idaapi.action_desc_t(name, text, self.StartHandler(self, name), shortcut, tooltip, icon) idaapi.register_action(description) idaapi.attach_action_to_menu(self.wanted_name + "/" + text, name, idaapi.SETMENU_APP)
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.RecognizeShape) 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) 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 ready_to_run(self): idaapi.register_action(action_change_server) idaapi.attach_action_to_menu("Edit/Plugins/IDAHub/ChangeServer", "sync:change_server", idaapi.SETMENU_APP) self._manager = user_manager() self._widget = StatusWidget(self._manager) self._widget.install(self._window)
def _attach_to_menu_items(self): self.search_magic_desc = idaapi.action_desc_t( 'idamagnum:searchmagic', 'search magic number ...', SearchMagicNumber(self), "Shift+M", 'Search this value on MagnumDB', ) self.configure_plugin_desc = idaapi.action_desc_t( 'idamagnum:configure', 'Configure', ConfigureIdaMagnum(self), "", 'Configure plugin', ) idaapi.register_action(self.search_magic_desc) idaapi.register_action(self.configure_plugin_desc) idaapi.attach_action_to_menu('Edit/Plugins/IdaMagnum/', 'idamagnum:searchmagic', idaapi.SETMENU_APP) idaapi.attach_action_to_menu('Edit/Plugins/IdaMagnum/', 'idamagnum:configure', idaapi.SETMENU_APP) return 0
def start(self): logger.info("YaCo.start()") self.YaCoUI.hook() try: self.ida_hooks.unhook() self.initial_load() idc.Wait() self.ida_hooks.hook() except: traceback.print_exc() self.YaCoUI.unhook() self.ida_hooks.unhook() logger.error('Error during load cache, YaCo is disabled !') idc.set_inf_attr(idc.INFFL_AUTO, False) for menu_item in self.yaco_menus: name = menu_item[0] text = menu_item[1] callback = menu_item[2] shortcut = menu_item[3] handler = YaCoHandler(self, callback) action = idaapi.action_desc_t(name, text, handler, shortcut, "") idaapi.register_action(action) idaapi.attach_action_to_menu("Edit/YaTools/", name, idaapi.SETMENU_APP) if PROFILE_YACO_LOADING: self.pr.disable() f = open("yaco-loading.profile", 'w') ps = pstats.Stats(self.pr, stream=f).sort_stats('time') ps.print_stats() f.close()
def init(self): idaapi.attach_action_to_menu('File/Load file/Rizzo signature file...', 'rizzo:load', idaapi.SETMENU_APP) idaapi.attach_action_to_menu( 'File/Produce file/Rizzo signature file...', 'rizzo:produce', idaapi.SETMENU_APP) return idaapi.PLUGIN_KEEP
def init(self): global p_initialized # register popup menu handlers try: Searcher.register(self, "Findcrypt") except: pass if p_initialized is False: p_initialized = True self.user_directory = self.get_user_directory() idaapi.register_action( idaapi.action_desc_t("Findcrypt", "Find crypto constants", Searcher(), None, None, 0)) idaapi.attach_action_to_menu("Search", "Findcrypt", idaapi.SETMENU_APP) print("=" * 80) print("Findcrypt v{0} by David BERARD, 2017".format(VERSION)) print("Findcrypt search shortcut key is Ctrl-Alt-F") print("Global rules in %s" % YARARULES_CFGFILE) print("User-defined rules in %s/*.rules" % self.user_directory) print("=" * 80) return idaapi.PLUGIN_KEEP
def init(self): global p_initialized # register popup menu handlers try: Searcher.register(self, "Findcrypt") except: pass if p_initialized is False: p_initialized = True idaapi.register_action( idaapi.action_desc_t("Findcrypt", "Find crypto constants", self.search, None, None, 0)) idaapi.attach_action_to_menu("Edit/Findcrypt", "Findcrypt", idaapi.SETMENU_APP) print("=" * 80) print("Findcrypt v{0} by David BERARD, 2017".format(VERSION)) print("Findcrypt search shortcut key is Ctrl-Alt-F") print("Rules in %s" % YARARULES_CFGFILE) if USRCFG: print("Found user rules in %s" % USRDIR) else: print("No user-defined rules in: %s" % USRDIR) print("=" * 80) return idaapi.PLUGIN_KEEP
def init(self): global p_initialized # register popup menu handlers try: Searcher.register(self, "FindYara") except: pass if p_initialized is False: p_initialized = True idaapi.register_action( idaapi.action_desc_t("FindYara", "Find crypto constants", Searcher(), None, None, 0)) idaapi.attach_action_to_menu("Search", "FindYara", idaapi.SETMENU_APP) ## Print a nice header print("=" * 80) print(" ____ __ __ __ ____ _ _ ___ ____ ___ ") print(" || || ||\\ || || \\\\ \\\\// // \\\\ || \\\\ // \\\\") print(" ||== || ||\\\\|| || )) )/ ||=|| ||_// ||=||") print(" || || || \\|| ||_// // || || || \\\\ || ||") print("\nFindYara v{0} by @herrcore".format(VERSION)) print("* All credit to David Berard (@_p0ly_) for the code! *") print("* This is a slightly modified version of findcrypt-yara *") print("\nFindYara search shortcut key is Ctrl-Alt-y") print("=" * 80) return idaapi.PLUGIN_KEEP
def init(self): if not idaapi.init_hexrays_plugin(): print "[ERROR] Failed to initialize Hex-Rays SDK" return isaapi.PLUGIN_SKIP idaapi.register_action( idaapi.action_desc_t( "mee:DeepDecompile1", "Deep Decompile Function", DeepDecompile(1), None ) ) idaapi.register_action( idaapi.action_desc_t( "mee:DeepDecompile3", "Deep Decompile Function 3 Deep", DeepDecompile(3), None ) ) self.hooks = Hooks() self.hooks.hook() idaapi.attach_action_to_menu("View/Open subviews/Local types","mee:DeepDecompile3",idaapi.SETMENU_APP) idaapi.attach_action_to_menu("View/Open subviews/Local types","mee:DeepDecompile1",idaapi.SETMENU_APP) idaapi.install_hexrays_callback(hexrays_events_callback) return idaapi.PLUGIN_KEEP
def init(self): if idaapi.IDA_SDK_VERSION >= 700: code_desc = idaapi.action_desc_t(self.code_action_name, 'Fixup Code', CodatifyFixupCode(), self.wanted_hotkey, 'Fixup Code', 199) data_desc = idaapi.action_desc_t(self.data_action_name, 'Fixup Data', CodatifyFixupData(), self.wanted_hotkey, 'Fixup Data', 199) idaapi.register_action(code_desc) idaapi.register_action(data_desc) idaapi.attach_action_to_menu(self.menu_tab, self.code_action_name, idaapi.SETMENU_APP) idaapi.attach_action_to_menu(self.menu_tab, self.data_action_name, idaapi.SETMENU_APP) else: self.menu_context.append( idaapi.add_menu_item("Options/", "Fixup code", "", 0, fix_code, (None, ))) self.menu_context.append( idaapi.add_menu_item("Options/", "Fixup data", "", 0, fix_data, (None, ))) return idaapi.PLUGIN_KEEP
def init(self): print('# PS4 Name2NID Plugin') if idaapi.IDA_SDK_VERSION < 700: print('Error: This plugin has only been tested on 7.0+') return PLUGIN_SKIP else: # Load Aerolib... #NIDS = load_nids('loaders', AEROLIB) idaapi.create_menu('PS4', 'PS4') action_desc = idaapi.action_desc_t('NIDify', 'NIDify', NIDify_Handler(), 'Ctrl+N', 'NIDify the selected name', 199) idaapi.register_action(action_desc) idaapi.attach_action_to_menu('PS4/NIDify', 'NIDify', idaapi.SETMENU_APP) ''' action_desc = idaapi.action_desc_t('Print NIDs', 'Print NIDs', Print_Handler(), 'Ctrl+H', 'Print the New NIDs', 199) idaapi.register_action(action_desc) idaapi.attach_action_to_menu('PS4/Print NIDs', 'Print NIDs', idaapi.SETMENU_APP) action_desc = idaapi.action_desc_t('Save NIDs', 'Save NIDs', Save_Handler(), 'Ctrl+Y', 'Save the New NIDs', 199) idaapi.register_action(action_desc) idaapi.attach_action_to_menu('PS4/Save NIDs', 'Save NIDs', idaapi.SETMENU_APP) ''' return PLUGIN_KEEP
def init(self): # Register the action self.menu_context_load = idaapi.action_desc_t( 'my:load_rizzo', # The action name. This acts like an ID and must be unique 'Rizzo signature file...', # The action text. LoadHandler(), # The action handler. '', # Optional: the action shortcut '', # Optional: the action tooltip (available in menus/toolbar) ) # Optional: the action icon (shows when in menus/toolbars) use numbers 1-255 # Register the action idaapi.register_action(self.menu_context_load) idaapi.attach_action_to_menu('File/Load file/', 'my:load_rizzo', idaapi.SETMENU_APP) self.menu_context_produce = idaapi.action_desc_t( 'my:produce_rizzo', # The action name. This acts like an ID and must be unique 'Rizzo signature file...', # The action text. ExportHandler(), # The action handler. '', # Optional: the action shortcut '', # Optional: the action tooltip (available in menus/toolbar) ) # Optional: the action icon (shows when in menus/toolbars) use numbers 1-255 # Register the action idaapi.register_action(self.menu_context_produce) idaapi.attach_action_to_menu('File/Produce file/', 'my:produce_rizzo', idaapi.SETMENU_APP) return idaapi.PLUGIN_KEEP
def init(self): if idaapi.IDA_SDK_VERSION >= 700: xref_current_func_desc = idaapi.action_desc_t( self.xref_current_func_action_name, self.xref_current_func_menu_name, FunctionProfilerFromFunctionActionHandler(), self.wanted_hotkey, 'Xrefs from the current function.', 199) all_xref_desc = idaapi.action_desc_t( self.all_xref_action_name, self.all_xref_menu_name, FunctionProfilerAllFunctionsActionHandler(), self.wanted_hotkey, 'All functions xref.', 199) idaapi.register_action(xref_current_func_desc) idaapi.register_action(all_xref_desc) idaapi.attach_action_to_menu(self.menu_tab, self.xref_current_func_action_name, idaapi.SETMENU_APP) idaapi.attach_action_to_menu(self.menu_tab, self.all_xref_action_name, idaapi.SETMENU_APP) else: self.menu_context.append( idaapi.add_menu_item(self.menu_tab, self.xref_current_func_menu_name, "", 0, from_function_profiler, (True, ))) self.menu_context.append( idaapi.add_menu_item(self.menu_tab, self.all_xref_menu_name, "", 0, all_functions_profiler, (False, ))) return idaapi.PLUGIN_KEEP
def init(self): if idaapi.IDA_SDK_VERSION >= 700: produce_desc = idaapi.action_desc_t(self.produce_action_name, self.menu_name, ProduceRizzoAction(), self.wanted_hotkey, self.produce_tooltip, 199) load_desc = idaapi.action_desc_t(self.load_action_name, self.menu_name, LoadRizzoAction(), self.wanted_hotkey, self.load_tooltip, 199) idaapi.register_action(produce_desc) idaapi.register_action(load_desc) idaapi.attach_action_to_menu( os.path.join(self.menu_tab, 'Produce file/'), self.produce_action_name, idaapi.SETMENU_APP) idaapi.attach_action_to_menu( os.path.join(self.menu_tab, 'Load file/'), self.load_action_name, idaapi.SETMENU_APP) else: self.menu_context.append( idaapi.add_menu_item(os.path.join(self.menu_tab, 'Load file/'), "Rizzo signature file...", "", 0, rizzo_load, (None, ))) self.menu_context.append( idaapi.add_menu_item( os.path.join(self.menu_tab, 'Produce file/'), "Rizzo signature file...", "", 0, rizzo_produce, (None, ))) return idaapi.PLUGIN_KEEP
def add_idaipython_menu(callback): class MyHandler(idaapi.action_handler_t): def __init__(self): idaapi.action_handler_t.__init__(self) def activate(self, ctx): callback() return 1 def update(self, ctx): return idaapi.AST_ENABLE_ALWAYS action_name = 'IDAIPython:QtConsole' action_desc = idaapi.action_desc_t( action_name, 'IDAIPython QtConsole', MyHandler(), '', 'Launch IDAIPython QtConsole', -1) idaapi.register_action(action_desc) idaapi.attach_action_to_menu( 'View/', action_name, idaapi.SETMENU_INS) return action_desc
def init(self): global p_initialized # register popup menu handlers try: Fluorescence.register(self, "Un/highlight call instructions") except: pass self.highlighted = False if p_initialized is False: p_initialized = True idaapi.register_action(idaapi.action_desc_t( "Fluorescence", "Highlights function calls", self.run, None, None, 0)) idaapi.attach_action_to_menu("Options/General...", "Fluorescence", idaapi.SETMENU_APP) print("=" * 80) print("Fluorescence v{0} by devttys0, 2017".format(VERSION)) print("=" * 80) return idaapi.PLUGIN_KEEP
def init(self): self.lines = set() self.settings = IDASettings('HighlightCalls') try: self.set_color(self.settings['color']) except KeyError: self.settings.user['color'] = HIGHLIGHT_COLOR self.set_color(HIGHLIGHT_COLOR) self.ui_hooks = UiHooks(self.lines) self.toggle_action_desc = idaapi.action_desc_t('HighlightCalls:Toggle', 'Toggle call highlighting', ToggleHighlightHandler(self.enable_highlights, self.disable_highlights), '', 'Toggle call highlighting', -1) idaapi.register_action(self.toggle_action_desc) self.color_selector = idaapi.action_desc_t('HighlightCalls:SelectColor', 'Select highlight color', SelectColorHandler(set_color=self.set_color), '', 'Select highlight color', -1) idaapi.register_action(self.color_selector) idaapi.attach_action_to_menu('View/', self.toggle_action_desc.name, idaapi.SETMENU_APP) idaapi.attach_action_to_menu('View/', self.color_selector.name, idaapi.SETMENU_APP) return idaapi.PLUGIN_KEEP
def init(self): global m_initialized # register popup menu handlers try: MIPS_Searcher.register(self, "mipsAudit") except: pass if m_initialized is False: m_initialized = True idaapi.register_action( idaapi.action_desc_t("mipsAudit", "Find MIPS Audit func", MIPS_Searcher(), None, None, 0)) idaapi.attach_action_to_menu("Search", "mipsAudit", idaapi.SETMENU_APP) print("=" * 80) start = ''' _ _ _ _ _ _ __ ___ (_)_ __ ___ / \ _ _ __| (_) |_ | '_ ` _ \| | '_ \/ __| / _ \| | | |/ _` | | __| | | | | | | | |_) \__ \/ ___ \ |_| | (_| | | |_ |_| |_| |_|_| .__/|___/_/ \_\__,_|\__,_|_|\__| |_| code by giantbranch 2018.05 edit by t3ls 2020.12 ''' print(start) print("=" * 80) return idaapi.PLUGIN_KEEP
def init(self): if idaapi.IDA_SDK_VERSION >= 700: idaapi.register_action( idaapi.action_desc_t(self.action_rizzo_loadfile, 'Rizzo signature file...', self.rizzo_loadHandler(), None, 'Rizzo signature file...')) idaapi.attach_action_to_menu("File/Load file/", self.action_rizzo_loadfile, idaapi.SETMENU_APP) idaapi.register_action( idaapi.action_desc_t(self.action_rizzo_producefile, 'Rizzo signature file...', self.rizzo_produceHandler(), None, 'Rizzo signature file...')) idaapi.attach_action_to_menu("File/Produce file/", self.action_rizzo_producefile, idaapi.SETMENU_APP) else: self.menu_context_load = idaapi.add_menu_item( "File/Load file/", "Rizzo signature file...", "", 0, self.rizzo_load, (None, )) self.menu_context_produce = idaapi.add_menu_item( "File/Produce file/", "Rizzo signature file...", "", 0, self.rizzo_produce, (True, )) return idaapi.PLUGIN_KEEP
def add_menus(self): # To avoid creating multiple plugin_t instances this = self class StartHandler(idaapi.action_handler_t): def __init__(self): idaapi.action_handler_t.__init__(self) def activate(self, ctx): this.run() return 1 def update(self, ctx): return idaapi.AST_ENABLE_ALWAYS act_name = '%s:start' % PLUGNAME act_desc = idaapi.action_desc_t( act_name, # The action name. Must be unique PLUGNAME, # Action Text StartHandler(), # Action handler None, # Optional shortcut 'Start plugin', # Action tooltip 122 # Icon ) idaapi.register_action(act_desc) idaapi.attach_action_to_menu( 'Debugger/Debugger windows/', act_name, idaapi.SETMENU_APP )
def init(self): self.view = None # create watcher self.watch = Watcher() # setup actions self.actions = ActionManager() self.actions.register("addmenuwindow", "Add Watch", self.addWatchWindow, -1, "Shift-A") self.actions.register("showview", "Show WatchDbg List", self.showWatchWindow, -1, "Shift-W") # setup menus idaapi.attach_action_to_menu('Debugger/WatchDbg', self.actions.get("showview"), idaapi.SETMENU_APP) self.uihook = UIHook() self.uihook.hook() self.dbghook = WatchDbgHook() self.dbghook.dbg_suspend_process = self.updateWatchWindow self.dbghook.hook() writeline("Successfully loaded! [v.%s]" % '.'.join(map(str, PLUGIN_VERSION))) return idaapi.PLUGIN_KEEP
def init(self): NO_HOTKEY = "" SETMENU_INS = 0 NO_ARGS = tuple() logger.debug("[+] %s.init()" % self.__class__.__name__) self.menuitems = [] logger.debug("[+] setting up menus for ida version %s" % idaapi.IDA_SDK_VERSION) if idaapi.IDA_SDK_VERSION >= 700: action_desc = idaapi.action_desc_t( "tintinweb:batchdecompile:load", self.wanted_name, IdaDecompileUiActionHandler(self)) idaapi.register_action(action_desc) idaapi.attach_action_to_menu(''.join(self.wanted_menu), "tintinweb:batchdecompile:load", idaapi.SETMENU_APP) else: menu = idaapi.add_menu_item(self.wanted_menu[0], self.wanted_menu[1], NO_HOTKEY, SETMENU_INS, self.menu_config, NO_ARGS) self.menuitems.append(menu) return idaapi.PLUGIN_KEEP
def init(self): global patcherex_window global patcherex_hooks if idaapi.get_inf_structure().procName != "metapc": print "Only x86 metapc is supported by Patcherex" return idaapi.PLUGIN_SKIP for command in commands: name = "patcherex:" + command.name idaapi.register_action( idaapi.action_desc_t(name, command.description, command.handler_class(), command.shortcut)) if command.menu_path: idaapi.attach_action_to_menu(command.menu_path, name, idaapi.SETMENU_APP) if patcherex_hooks is None: patcherex_hooks = [PopHook([command.name for command in commands]), SaveLoadHook()] for hook in patcherex_hooks: hook.hook() if patcherex_window is None: print "Patcherex starting" self.patcherex_window = PatcherexWindow() patcherex_window = self.patcherex_window else: self.patcherex_window = patcherex_window patcherex_window.load_saved_patches() return idaapi.PLUGIN_OK
def init(self): self.lines = set() self.settings = IDASettings('HighlightCalls') try: self.set_color(self.settings['color']) except KeyError: self.settings.user['color'] = HIGHLIGHT_COLOR self.set_color(HIGHLIGHT_COLOR) self.ui_hooks = UiHooks(self.lines) self.toggle_action_desc = idaapi.action_desc_t( 'HighlightCalls:Toggle', 'Toggle call highlighting', ToggleHighlightHandler(self.enable_highlights, self.disable_highlights), '', 'Toggle call highlighting', -1) idaapi.register_action(self.toggle_action_desc) self.color_selector = idaapi.action_desc_t( 'HighlightCalls:SelectColor', 'Select highlight color', SelectColorHandler(set_color=self.set_color), '', 'Select highlight color', -1) idaapi.register_action(self.color_selector) idaapi.attach_action_to_menu('Edit/', self.toggle_action_desc.name, idaapi.SETMENU_APP) idaapi.attach_action_to_menu('Edit/', self.color_selector.name, idaapi.SETMENU_APP) return idaapi.PLUGIN_KEEP
def init(self): global p_initialized # register popup menu handlers try: Searcher.register(self, "Findcrypt") except: pass if p_initialized is False: p_initialized = True idaapi.register_action(idaapi.action_desc_t( "Findcrypt", "Find crypto constants", self.search, None, None, 0)) idaapi.attach_action_to_menu("Edit/Findcrypt", "Findcrypt", idaapi.SETMENU_APP) print("=" * 80) print("Findcrypt v{0} by David BERARD, 2017".format(VERSION)) print("Findcrypt search shortcut key is Ctrl-Alt-F") print("Rules in %s" % YARARULES_CFGFILE) print("=" * 80) return idaapi.PLUGIN_KEEP
def init(self): if idaapi.IDA_SDK_VERSION >= 700: leaf_desc = idaapi.action_desc_t(self.leaf_function_action_name, self.leaf_function_name, LeafFunctionAction(), self.wanted_hotkey, self.leaf_function_tooltip, 199) format_string_desc = idaapi.action_desc_t( self.format_string_action_name, self.format_string_name, FormatStringFunctionAction(), self.wanted_hotkey, self.format_string_tooltip, 199) idaapi.register_action(leaf_desc) idaapi.register_action(format_string_desc) idaapi.attach_action_to_menu(self.menu_tab, self.leaf_function_action_name, idaapi.SETMENU_APP) idaapi.attach_action_to_menu(self.menu_tab, self.format_string_action_name, idaapi.SETMENU_APP) else: self.menu_context.append( idaapi.add_menu_item(self.menu_tab, self.leaf_function_name, "", 0, leaf_from_menu, (None, ))) self.menu_context.append( idaapi.add_menu_item(self.menu_tab, self.format_string_name, "", 0, format_from_menu, (None, ))) return idaapi.PLUGIN_KEEP
def init(self): if idaapi.IDA_SDK_VERSION >= 700: leaf_desc = idaapi.action_desc_t(self.leaf_function_action_name, self.leaf_function_name, LeafFunctionAction(), self.wanted_hotkey, self.leaf_function_tooltip, 199) format_string_desc = idaapi.action_desc_t(self.format_string_action_name, self.format_string_name, FormatStringFunctionAction(), self.wanted_hotkey, self.format_string_tooltip, 199) idaapi.register_action(leaf_desc) idaapi.register_action(format_string_desc) idaapi.attach_action_to_menu(self.menu_tab, self.leaf_function_action_name, idaapi.SETMENU_APP) idaapi.attach_action_to_menu(self.menu_tab, self.format_string_action_name, idaapi.SETMENU_APP) else: self.menu_context.append(idaapi.add_menu_item(self.menu_tab, self.leaf_function_name, "", 0, leaf_from_menu, (None,))) self.menu_context.append(idaapi.add_menu_item(self.menu_tab, self.format_string_name, "", 0, format_from_menu, (None,))) return idaapi.PLUGIN_KEEP
def add_menu_items(self): """ Init additions to Ida's menu entries """ if idaapi.IDA_SDK_VERSION <= 695: def add_menu_item_helper(self, menupath, name, hotkey, flags, pyfunc, args): """ helper for adding a menu item """ # add menu item and report on errors addmenu_item_ctx = idaapi.add_menu_item( menupath, name, hotkey, flags, pyfunc, args) if addmenu_item_ctx is None: return 1 else: self.addmenu_item_ctxs.append(addmenu_item_ctx) return 0 if add_menu_item_helper(self, "Search/all error operands", "list rop gadgets...", "Ctrl+Shift+r", 1, self.proc_rop, None): return 1 if add_menu_item_helper(self, "View/Open subviews/Problems", "View rop gadgets...", "Shift+r", 1, self.show_rop_view, None): return 1 return 0 elif idaapi.IDA_SDK_VERSION >= 700: search_gadgets_desc = idaapi.action_desc_t( 'idarop:searchgadgets', 'search rop gadgets...', SearchGadgetsHandler(self), "Ctrl+Shift+r", 'search all gadgets available on this binary', ) idaapi.register_action(search_gadgets_desc) idaapi.attach_action_to_menu('Search/IdaRop/', 'idarop:searchgadgets', idaapi.SETMENU_APP) list_gadgets_desc = idaapi.action_desc_t( 'idarop:listgadgets', 'list rop gadgets...', ListGadgetsHandler(self), "Shift+r", 'list all gadgets searched on this binary', ) idaapi.register_action(list_gadgets_desc) idaapi.attach_action_to_menu('Search/IdaRop/', 'idarop:listgadgets', idaapi.SETMENU_APP) return 0 else: return 0
def init(self): if idaapi.IDA_SDK_VERSION >= 700: action_desc = idaapi.action_desc_t("act:mipsrop", "mips rop gadgets", MIPSROPHandler(), "", "Find mips rop gadgets",) idaapi.register_action(action_desc) idaapi.attach_action_to_menu("Search/", "act:mipsrop", idaapi.SETMENU_FIRST) else: self.menu_context = idaapi.add_menu_item("Search/", "mips rop gadgets", "", 0, self.run, (None,)) return idaapi.PLUGIN_KEEP
def init(): NO_HOTKEY = "" SETMENU_INS = 0 NO_ARGS = tuple() idaapi.register_action(idaapi.action_desc_t(ConfigStingray.ACTION_NAME, "{} ConfigStingray".format(ConfigStingray.PLUGIN_NAME), ConfigStingray())) idaapi.attach_action_to_menu("Options/", ConfigStingray.ACTION_NAME, idaapi.SETMENU_APP) ConfigStingray.load()
def init(self): testAction = self.testAction action_desc = idaapi.action_desc_t(testAction.name, testAction.description, testAction, testAction.hotkey, 'TestActio tip', 199) idaapi.register_action(action_desc) idaapi.attach_action_to_menu(MenuAttach.menu_name, testAction.name, idaapi.SETMENU_APP) return idaapi.PLUGIN_KEEP
def init(self): idaapi.msg('===================================================\n') idaapi.msg('pltResolver plugin has been loaded.\n') idaapi.msg('Press Ctrl+Shift+J to resolve .plt.sec symbols.\n') idaapi.msg('===================================================\n') idaapi.register_action(idaapi.action_desc_t('pltResolver:pltResolver', 'Parse .plt.sec symbols', PltResolver_handler(), 'Ctrl+Shift+J', None, 25))#注册action idaapi.attach_action_to_menu('Edit/pltResolver', 'pltResolver:pltResolver', idaapi.SETMENU_APP)#å°†actionæ·»åŠ åˆ°menu return idaapi.PLUGIN_KEEP
def init(self): ShowXrefsGraphTo.register() ShowXrefsGraphFrom.register() idaapi.attach_action_to_menu(MENU_PATH_GRAPHS, ShowXrefsGraphTo.get_name(), 0) idaapi.attach_action_to_menu(MENU_PATH_GRAPHS, ShowXrefsGraphFrom.get_name(), 0) self.hooks = Hooks() self.hooks.hook() return idaapi.PLUGIN_KEEP
def ev_oldfile(self, fname): log("START") selector = ProjectSelector(request_project_list()) selector.Compile() selector.Execute() if shared.IS_COMMUNICATION_MANAGER_STARTED: constants.send_data_to_window(shared.COMMUNICATION_MANAGER_WINDOW_ID, constants.CHANGE_PROJECT_ID, json.dumps({"project-id": shared.PROJECT_ID, "need-to-pull": shared.MASTER_PAUSE_HOOK})) if shared.MASTER_PAUSE_HOOK: idaapi.register_action(action_manual_pull) idaapi.attach_action_to_menu("Edit/Plugins/IDAHub/Pull from server", "idahub:manual_pull",idaapi.SETMENU_APP) return ida_idp.IDP_Hooks.ev_oldfile(self, fname)
def init(self): self._lca_viewer = None self._lca_starter = lca_viewer_starter(self) self._lca_starter.register() idaapi.attach_action_to_menu("View/Graph Overview", self._lca_starter.get_name(), idaapi.SETMENU_APP) self._idaview_handler = idaview_add_target_handler(self) self._idaview_handler.register() self._hooks = idaview_hooks(self._idaview_handler)() self._hooks.hook() return idaapi.PLUGIN_KEEP
def init(self): if idaapi.IDA_SDK_VERSION >= 700: fluorescence_desc = idaapi.action_desc_t(self.fluorescence_action_name, self.menu_name, FluorescenceActionHandler(), self.wanted_hotkey, 'Highlights function calls.', 199) idaapi.register_action(fluorescence_desc) idaapi.attach_action_to_menu(self.menu_tab, self.fluorescence_action_name, idaapi.SETMENU_APP) else: self.context_menu = idaapi.add_menu_item(self.menu_tab, self.menu_name, "", 0, self.highlight, (None,)) return idaapi.PLUGIN_KEEP
def init(self): if idaapi.IDA_SDK_VERSION >= 700: # 199 is a default icon. action_desc = idaapi.action_desc_t(self.action_name, self.menu_name, MipsRopHandler(), self.wanted_hotkey, self.wanted_tooltip, 199) idaapi.register_action(action_desc) idaapi.attach_action_to_menu(self.root_tab, self.action_name, idaapi.SETMENU_APP) else: self.menu_context = idaapi.add_menu_item("Search/", self.menu_name, "", 0, self.run, (None,)) return idaapi.PLUGIN_KEEP
def init(self): if idaapi.IDA_SDK_VERSION >= 700: action_desc = idaapi.action_desc_t(self.action_name, self.menu_name, MipsSavedRegistersAction(), self.wanted_hotkey, self.wanted_tooltip, 199) idaapi.register_action(action_desc) idaapi.attach_action_to_menu(self.menu_tab, self.action_name, idaapi.SETMENU_APP) else: self.menu_context = idaapi.add_menu_item(self.menu_tab, self.menu_name, "", 0, name_saved_registers, (None,)) return idaapi.PLUGIN_KEEP
def init(self): if idaapi.IDA_SDK_VERSION <= 695: self.menu_context_1 = idaapi.add_menu_item( "Search/", "binwalk opcodes", "", 0, self.opcode_scan, (None,)) self.menu_context_2 = idaapi.add_menu_item( "Search/", "binwalk signatures", "", 0, self.signature_scan, (None,)) if idaapi.IDA_SDK_VERSION >= 700: # populate action menus action_desc = idaapi.action_desc_t( 'my:opaction', # action name. This acts like an ID and must be unique 'Binwalk opcodes', # text for this action OpHandler(), # the action handler '', # optional shortcut key 'Binwalk opcodes', # optional action tooltip for menus/toolbar ) # Register the action idaapi.register_action(action_desc) idaapi.attach_action_to_menu( 'Search/', 'my:opaction', idaapi.SETMENU_APP) # populate action menus action_desc = idaapi.action_desc_t( 'my:sigaction', 'Binwalk signatures', SigHandler(), '', 'Binwalk signatures', ) # Register the action idaapi.register_action(action_desc) idaapi.attach_action_to_menu( 'Search/', 'my:sigaction', idaapi.SETMENU_APP) else: pass return idaapi.PLUGIN_KEEP
def init(self): if idaapi.IDA_SDK_VERSION >= 700: produce_desc = idaapi.action_desc_t(self.produce_action_name, self.menu_name, ProduceRizzoAction(), self.wanted_hotkey, self.produce_tooltip, 199) load_desc = idaapi.action_desc_t(self.load_action_name, self.menu_name, LoadRizzoAction(), self.wanted_hotkey, self.load_tooltip, 199) idaapi.register_action(produce_desc) idaapi.register_action(load_desc) idaapi.attach_action_to_menu(os.path.join(self.menu_tab, 'Produce file/'), self.produce_action_name, idaapi.SETMENU_APP) idaapi.attach_action_to_menu(os.path.join(self.menu_tab, 'Load file/'), self.load_action_name, idaapi.SETMENU_APP) else: self.menu_context.append( idaapi.add_menu_item(os.path.join(self.menu_tab, 'Load file/'), "Rizzo signature file...", "", 0, rizzo_load, (None,))) self.menu_context.append( idaapi.add_menu_item(os.path.join(self.menu_tab, 'Produce file/'), "Rizzo signature file...", "", 0, rizzo_produce, (None,))) return idaapi.PLUGIN_KEEP
def _add_menus(self): ret = [] if idaapi.IDA_SDK_VERSION <= 695: menu_path = MENU_PATH if idaapi.IDA_SDK_VERSION > 660 else ALTERNATIVE_MENU_PATH ret.append(self._add_menu(menu_path, 'Stop IdaRef', '', 1, self.stop, tuple())) ret.append(self._add_menu(menu_path, 'Start IdaRef', '', 1, self.start, tuple())) if idaapi.IDA_SDK_VERSION >= 700: action_desc = idaapi.action_desc_t( 'idaref:stop', # The action name. Must be unique 'Stop Idaref', # Action Text StopHandler(), # Action handler '', # Optional shortcut 'Stop Idaref' # Action tooltip ) idaapi.register_action(action_desc) idaapi.attach_action_to_menu( MENU_PATH, 'idaref:stop', idaapi.SETMENU_APP ) action_desc = idaapi.action_desc_t( 'idaref:start', # The action name. Must be unique 'Start Idaref', # Action Text StartHandler(), # Action handler '', # Optional shortcut 'Start Idaref' # Action tooltip ) idaapi.register_action(action_desc) idaapi.attach_action_to_menu( MENU_PATH, 'idaref:start', idaapi.SETMENU_APP ) if False in ret: return idaapi.PLUGIN_SKIP else: return idaapi.PLUGIN_KEEP
def ui_init(self): """Initializes the plugins interface extensions.""" # Register menu entry. # @HR: I really preferred the pre-6.5 mechanic. zelf = self class MenuEntry(idaapi.action_handler_t): def activate(self, ctx): zelf.open_proj_creation_dialog() return 1 def update(self, ctx): return idaapi.AST_ENABLE_ALWAYS action = idaapi.action_desc_t( 'continuum_new_project', "New continuum project...", MenuEntry(), ) idaapi.register_action(action) idaapi.attach_action_to_menu("File/Open...", 'continuum_new_project', 0) # Alright, is an IDB loaded? Pretend IDB open event as we miss the callback # when it was loaded before our plugin was staged. if GetIdbPath(): self.core.handle_open_idb(None, None) # Register hotkeys. idaapi.add_hotkey('Shift+F', self.core.follow_extern) # Sign up for events. self.core.project_opened.connect(self.create_proj_explorer) self.core.project_closing.connect(self.close_proj_explorer) self.core.client_created.connect(self.subscribe_client_events) # Project / client already open? Fake events. if self.core.project: self.create_proj_explorer(self.core.project) if self.core.client: self.subscribe_client_events(self.core.client)
def registerAction(self): action_desc = idaapi.action_desc_t( self.id, self.name, self, "", self.tooltip, self.icon ) if not idaapi.register_action(action_desc): return False if not idaapi.attach_action_to_menu(self.menuPath, self.id, 0): return False if not idaapi.attach_action_to_toolbar("AnalysisToolBar", self.id): return False return True
def registerAction(self, addToToolBar = True): action_desc = idaapi.action_desc_t( self.id, # The action id self.name, # The action text. self, # The action handler. self.shortcut, # Optional: the action shortcut self.tooltip, # Optional: the action tooltip (available in menus/toolbar) self.icon) # Optional: the action icon (shows when in menus/toolbars) if not idaapi.register_action(action_desc): return False if not idaapi.attach_action_to_menu(self.menuPath, self.id, 0): return False if addToToolBar: if not idaapi.attach_action_to_toolbar("SearchToolBar", self.id): return False return True
def init(self): if idaapi.IDA_SDK_VERSION >= 700: # Add ALLEYCAT_LIMIT variable to the global namespace so it can be accessed from the IDA python terminal. global ALLEYCAT_LIMIT add_to_namespace('__main__', 'alleycat', 'ALLEYCAT_LIMIT', ALLEYCAT_LIMIT) # Add functions to global namespace. add_to_namespace('__main__', 'alleycat', 'AlleyCatFunctionPaths', AlleyCatFunctionPaths) add_to_namespace('__main__', 'alleycat', 'AlleyCatCodePaths', AlleyCatCodePaths) add_to_namespace('__main__', 'alleycat', 'AlleyCatGraph', AlleyCatGraph) to_curr_from_desc = idaapi.action_desc_t(self.to_from_action_name, self.to_from_menu_name, ToCurrentFromAction(), self.wanted_hotkey, 'Find paths to the current function from...', 199) from_curr_to_desc = idaapi.action_desc_t(self.from_to_action_name, self.from_to_menu_name, FromCurrentToAction(), self.wanted_hotkey, 'Find paths from the current function to...', 199) curr_func_to_block_desc = idaapi.action_desc_t(self.curr_func_curr_block_action_name, self.curr_func_curr_block_menu_name, InCurrentFunctionToCurrentCodeBlockAction(), self.wanted_hotkey, 'Find paths in the current function to the current code block', 199) idaapi.register_action(to_curr_from_desc) idaapi.register_action(from_curr_to_desc) idaapi.register_action(curr_func_to_block_desc) idaapi.attach_action_to_menu(self.menu_name, self.to_from_action_name, idaapi.SETMENU_APP) idaapi.attach_action_to_menu(self.menu_name, self.from_to_action_name, idaapi.SETMENU_APP) idaapi.attach_action_to_menu(self.menu_name, self.curr_func_curr_block_action_name, idaapi.SETMENU_APP) else: self.menu_context.append(idaapi.add_menu_item(self.menu_name, self.to_from_menu_name, "", 0, find_paths_from_many, (None,))) self.menu_context.append(idaapi.add_menu_item(self.menu_name, self.from_to_menu_name, "", 0, find_paths_to_many, (None,))) self.menu_context.append(idaapi.add_menu_item(self.menu_name, self.curr_func_curr_block_menu_name, "", 0, find_paths_to_code_block, (None,))) return idaapi.PLUGIN_KEEP
def populate_form(self): ''' Populate form contents ''' # Main layout # --------------------- main_layout = QtWidgets.QVBoxLayout() self.parent.setLayout(main_layout) # Choose file group box # --------------------- choose_file_groupbox = QtWidgets.QGroupBox( "Choose file to load (interproc or apitracer binary file)") choose_file_groupbox_layout = QtWidgets.QHBoxLayout() choose_file_groupbox.setLayout(choose_file_groupbox_layout) main_layout.addWidget(choose_file_groupbox) # Line edit self.choose_file_lineedit = QtWidgets.QLineEdit("") self.choose_file_lineedit.setReadOnly(True) # Select button btn_selectfile = QtWidgets.QPushButton('Select', self.parent) width = btn_selectfile.fontMetrics().boundingRect( 'Select').width() + 30 btn_selectfile.setMaximumWidth(width) btn_selectfile.clicked.connect(self.show_file_dialog) # Load functions button self.btn_loadfile = QtWidgets.QPushButton( 'Load functions', self.parent) width = self.btn_loadfile.fontMetrics().boundingRect( 'Load functions').width() + 30 self.btn_loadfile.setMaximumWidth(width) self.btn_loadfile.setEnabled(False) self.btn_loadfile.clicked.connect(self.load_file) choose_file_groupbox_layout.addWidget(self.choose_file_lineedit) choose_file_groupbox_layout.addWidget(btn_selectfile) choose_file_groupbox_layout.addWidget(self.btn_loadfile) # Choose PID groupbox # --------------------- choose_pid_groupbox = QtWidgets.QGroupBox("Choose PID to visualize") choose_pid_groupbox_layout = QtWidgets.QHBoxLayout() choose_pid_groupbox.setLayout(choose_pid_groupbox_layout) main_layout.addWidget(choose_pid_groupbox) # Combobox self.combo_pids = QtWidgets.QComboBox() self.combo_pids.setEditable(False) self.combo_pids.currentIndexChanged[ 'QString'].connect(self.combo_pids_changed) choose_pid_groupbox_layout.addWidget(self.combo_pids) # Apply button btn_apply = QtWidgets.QPushButton('Apply', self.parent) width = btn_apply.fontMetrics().boundingRect('Apply').width() + 30 btn_apply.setMaximumWidth(width) btn_apply.clicked.connect(self.apply_functions) choose_pid_groupbox_layout.addWidget(btn_apply) # Apply and rename button btn_apply_rename = QtWidgets.QPushButton( 'Apply and rename', self.parent) width = btn_apply.fontMetrics().boundingRect( 'Apply and rename').width() + 30 btn_apply_rename.setMaximumWidth(width) btn_apply_rename.clicked.connect( functools.partial(self.apply_functions, rename=True)) choose_pid_groupbox_layout.addWidget(btn_apply_rename) # Filters groupbox # --------------------- filter_groupbox = QtWidgets.QGroupBox("Filter functions") filter_groupbox_layout = QtWidgets.QGridLayout() filter_groupbox_layout.setSpacing(10) filter_groupbox.setLayout(filter_groupbox_layout) main_layout.addWidget(filter_groupbox) # Filter 1 - Function name filter1_label = QtWidgets.QLabel() filter1_label.setText("Function name") filter_groupbox_layout.addWidget(filter1_label, 1, 0) self.filter_fname_lineedit = QtWidgets.QLineEdit("") self.filter_fname_lineedit.setReadOnly(False) filter_groupbox_layout.addWidget(self.filter_fname_lineedit, 1, 1) self.filter_fname_lineedit.textEdited.connect(self.filter_edited) # Filter 2 - Dll name filter2_label = QtWidgets.QLabel() filter2_label.setText("DLL name") filter_groupbox_layout.addWidget(filter2_label, 2, 0) self.filter_dll_lineedit = QtWidgets.QLineEdit("") self.filter_dll_lineedit.setReadOnly(False) filter_groupbox_layout.addWidget(self.filter_dll_lineedit, 2, 1) self.filter_dll_lineedit.textEdited.connect(self.filter_edited) # Filter 3 - Caller filter3_label = QtWidgets.QLabel() filter3_label.setText("Caller") filter_groupbox_layout.addWidget(filter3_label, 3, 0) self.filter_caller_lineedit = QtWidgets.QLineEdit("") self.filter_caller_lineedit.setReadOnly(False) filter_groupbox_layout.addWidget(self.filter_caller_lineedit, 3, 1) self.filter_caller_lineedit.textEdited.connect(self.filter_edited) # Filter 4 - Return filter4_label = QtWidgets.QLabel() filter4_label.setText("Return") filter_groupbox_layout.addWidget(filter4_label, 4, 0) self.filter_return_lineedit = QtWidgets.QLineEdit("") self.filter_return_lineedit.setReadOnly(False) filter_groupbox_layout.addWidget(self.filter_return_lineedit, 4, 1) self.filter_return_lineedit.textEdited.connect(self.filter_edited) # QTreeView # ---------------------- self.treeview = QtWidgets.QTreeView() main_layout.addWidget(self.treeview) self.treemodel = QtGui.QStandardItemModel() self.treemodel.setHorizontalHeaderLabels( ["Function", "Dll", "Caller", "Return"]) self.treeview.setModel(self.treemodel) # Keyboard shortcut, and action handler # ------------------------------------- handler = MyActionHandler(self.show_func_dialog) self.menu_action = idaapi.action_desc_t('pyrebox:show_funcs', 'Show function arguments', handler, 'Ctrl+Alt+S', 'Show function arguments', 0) idaapi.register_action(self.menu_action) # Regular menu entry # ------------------------------------- # The relative path of where to add the action idaapi.attach_action_to_menu('Edit/Other/Show function arguments...', 'pyrebox:show_funcs', # The action ID (see above) idaapi.SETMENU_APP)
name = demangled_output[0].strip() demangled_name = demangled_output[1].strip() if name == demangled_name: continue count += 1 self.comment_xrefs(funcea, demangled_name) print 'Successfully demangled %d functions' % count def demangle(self, name): return subprocess.check_output(['/usr/bin/swift-demangle', name]) def comment_xrefs(self, ea, comment): for xref in XrefsTo(ea): idaapi.add_long_cmt(xref.frm, 1, comment) action_desc = idaapi.action_desc_t( 'swift-demangle', 'Demangle swift functions', SwiftDemangle(), ) idaapi.register_action(action_desc) idaapi.attach_action_to_menu( 'Edit/Plugins/Jump to next fixup', 'swift-demangle', idaapi.SETMENU_APP, )
act_icon = idaapi.load_custom_icon(data=icon_data, format="png") hooks = None act_name = "example:add_action" if idaapi.register_action(idaapi.action_desc_t( act_name, # Name. Acts as an ID. Must be unique. "Say hi!", # Label. That's what users see. SayHi("developer"), # Handler. Called when activated, and for updating "Ctrl+F12", # Shortcut (optional) "Greets the user", # Tooltip (optional) act_icon)): # Icon ID (optional) print("Action registered. Attaching to menu.") # Insert the action in the menu if idaapi.attach_action_to_menu("Edit/Export data", act_name, idaapi.SETMENU_APP): print("Attached to menu.") else: print("Failed attaching to menu.") # Insert the action in a toolbar if idaapi.attach_action_to_toolbar("AnalysisToolBar", act_name): print("Attached to toolbar.") else: print("Failed attaching to toolbar.") # We will also want our action to be available in the context menu # for the "IDA View-A" widget. # # To do that, we could in theory retrieve a reference to "IDA View-A", and # then request to "permanently" attach the action to it, using something