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): ui_path = "View/Graphs/" self.menu_contexts = [] self.graph = None #self.menu_contexts.append(idaapi.add_menu_item(ui_path, # "Find code paths to the current function block", # "Alt-7", # 0, # self.FindBlockPaths, # (None,))) self.menu_contexts.append( idaapi.add_menu_item(ui_path, "Find function path(s) to here", "Alt-6", 0, self.FindPathsFromMany, (None, ))) #self.menu_contexts.append(idaapi.add_menu_item(ui_path, # "Find paths to here from a single function", # "Alt-7", # 0, # self.FindPathsFromSingle, # (None,))) self.menu_contexts.append( idaapi.add_menu_item(ui_path, "Find function path(s) from here", "Alt-5", 0, self.FindPathsToMany, (None, ))) #self.menu_contexts.append(idaapi.add_menu_item(ui_path, # "Find paths from here to a single function", # "Alt-5", # 0, # self.FindPathsToSingle, # (None,))) 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: 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): ui_path = "View/Graphs/" self.menu_contexts = [] self.graph = None self.menu_contexts.append(idaapi.add_menu_item(ui_path, "Find paths to the current function from...", "", 0, self.FindPathsFromMany, (None,))) self.menu_contexts.append(idaapi.add_menu_item(ui_path, "Find paths from the current function to...", "", 0, self.FindPathsToMany, (None,))) self.menu_contexts.append(idaapi.add_menu_item(ui_path, "Find paths in the current function to the current code block", "", 0, self.FindPathsToCodeBlock, (None,))) 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 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 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 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): ui_path = "View/Graphs/" self.menu_contexts = [] self.graph = None # self.menu_contexts.append(idaapi.add_menu_item(ui_path, # "Find code paths to the current function block", # "Alt-7", # 0, # self.FindBlockPaths, # (None,))) self.menu_contexts.append( idaapi.add_menu_item(ui_path, "Find function path(s) to here", "Alt-6", 0, self.FindPathsFromMany, (None,)) ) # self.menu_contexts.append(idaapi.add_menu_item(ui_path, # "Find paths to here from a single function", # "Alt-7", # 0, # self.FindPathsFromSingle, # (None,))) self.menu_contexts.append( idaapi.add_menu_item(ui_path, "Find function path(s) from here", "Alt-5", 0, self.FindPathsToMany, (None,)) ) # self.menu_contexts.append(idaapi.add_menu_item(ui_path, # "Find paths from here to a single function", # "Alt-5", # 0, # self.FindPathsToSingle, # (None,))) return idaapi.PLUGIN_KEEP
def init(self): self.settings = IDASettings("Autoruns") exec(self._code) self.menu_items = [] idaapi.add_menu_item("View/", "Edit Autoruns", "", idaapi.SETMENU_INS, self._edit, tuple()) return idaapi.PLUGIN_KEEP
def init(self): self.menu_context = idaapi.add_menu_item("Options/", "Fixup code", "Alt-3", 0, self.fix_code, (None, )) self.menu_context = idaapi.add_menu_item("Options/", "Fixup data", "Alt-4", 0, self.fix_data, (None, )) return idaapi.PLUGIN_KEEP
def init(self): 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 init(self): self.menu_context_2 = idaapi.add_menu_item( "View/Open subviews/", "Xrefs from the current function", "", 0, self.run, (True,) ) self.menu_context_1 = idaapi.add_menu_item( "View/Open subviews/", "All function xrefs", "", 0, self.run, (False,) ) return idaapi.PLUGIN_KEEP
def init(self): self.menu_context_2 = idaapi.add_menu_item( "View/Open subviews/", "Xrefs from the current function", "", 0, self.run, (True, )) self.menu_context_1 = idaapi.add_menu_item("View/Open subviews/", "All function xrefs", "", 0, self.run, (False, )) return idaapi.PLUGIN_KEEP
def init(self): self.leaf_context_menu = idaapi.add_menu_item("Search/", "leaf functions", "", 0, self.LeafFromMenu, (None, )) self.stdio_context_menu = idaapi.add_menu_item( "Search/", "format string functions", "", 0, self.FormatFromMenu, (None, )) return idaapi.PLUGIN_KEEP
def init(self): self.xref_to = idaapi.add_menu_item(MENU_PATH_GRAPHS, 'Xrefs to source', '', 0, show_xrefs_to, None) self.xref_from = idaapi.add_menu_item(MENU_PATH_GRAPHS, 'Xrefs from source', '', 0, show_xrefs_from, None) return idaapi.PLUGIN_KEEP
def init(self): self.settings = IDASettings('Autoruns') exec(self._code) self.menu_items = [] idaapi.add_menu_item('View/', 'Edit Autoruns', '', idaapi.SETMENU_INS, self._edit, tuple()) return idaapi.PLUGIN_KEEP
def init(self): 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, )) return idaapi.PLUGIN_KEEP
def AddMenus(self): self.menus.append( idaapi.add_menu_item("Edit/Plugin/", "Sunrace: One prof make funcs", "Alt+F3", 0, self.OneProfMakeFuncs, ())) self.menus.append( idaapi.add_menu_item("Edit/Plugin/", "Sunrace: One prof color trace", "Alt+F1", 0, self.OneProfColor, ())) self.menus.append( idaapi.add_menu_item("Edit/Plugin/", "Sunrace: Two profs make funcs", "Alt+F4", 0, self.TwoProfMakeFuncs, ())) self.menus.append( idaapi.add_menu_item("Edit/Plugin/", "Sunrace: Two profs color trace", "Alt+F2", 0, self.TwoProfColor, ())) self.menus.append( idaapi.add_menu_item("Edit/Plugin/", "Sunrace: Get current funcs view", "Alt+1", 0, self.GetCurrentFuncsView, ())) self.menus.append( idaapi.add_menu_item("Edit/Plugin/", "Sunrace: Clear colors", "Alt+Q", 0, self.ClearColors, ())) self.menus.append( idaapi.add_menu_item("Edit/Plugin/", "Sunrace: REanalyse Colors, plz", "Alt+R", 0, self.REanalyseColors, ())) self.menus.append( idaapi.add_menu_item("Edit/Plugin/", "Sunrace: Exit", "Ctrl+Q", 0, self.term, ())) self.menus.append( idaapi.add_menu_item("Edit/Plugin/", "Sunrace: Quick Help", "Alt+Z", 0, self.QHelp, ()))
def init(self): try: Rizzo_MC_Load.register(self, "Rizzo signature file...") Rizzo_MC_Produce.register(self, "Rizzo signature file...") except: pass if idaapi.IDA_SDK_VERSION >= 700: idaapi.attach_action_to_menu("File/Load file/Rizzo signature file...", Rizzo_MC_Load.get_name(), idaapi.SETMENU_APP) idaapi.attach_action_to_menu("File/Produce file/Rizzo signature file...", Rizzo_MC_Produce.get_name(), 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 init(self): ui_path = "View/Graphs/" self.menu_contexts = [] # IDA 7.x if idaapi.IDA_SDK_VERSION >= 700: idaapi.register_action( idaapi.action_desc_t( action_alleycat_from, 'Find paths to the current function from...', FindPathsFromManyHandler(), None, 'Find paths from other function to the current function')) idaapi.attach_action_to_menu(ui_path, action_alleycat_from, idaapi.SETMENU_APP) idaapi.register_action( idaapi.action_desc_t( action_alleycat_to, 'Find paths from the current function to...', FindPathsToManyHandler(), None, 'Find paths from the current function to other function')) idaapi.attach_action_to_menu(ui_path, action_alleycat_to, idaapi.SETMENU_APP) idaapi.register_action( idaapi.action_desc_t( action_alleycat_block, 'Find paths in the current function to the current code block', FindPathsToCodeBlockHandler(), None, 'Find paths in the current function to the current code block' )) idaapi.attach_action_to_menu(ui_path, action_alleycat_block, idaapi.SETMENU_APP) # IDA 6.x else: self.menu_contexts.append( idaapi.add_menu_item( ui_path, "Find paths to the current function from...", "", 0, self.FindPathsFromMany, (None, ))) self.menu_contexts.append( idaapi.add_menu_item( ui_path, "Find paths from the current function to...", "", 0, self.FindPathsToMany, (None, ))) self.menu_contexts.append( idaapi.add_menu_item( ui_path, "Find paths in the current function to the current code block", "", 0, self.FindPathsToCodeBlock, (None, ))) return idaapi.PLUGIN_KEEP
def AddMenus(self): self.menus.append(idaapi.add_menu_item("Edit/Plugin/", "Sunrace: One prof make funcs", "Alt+F3", 0, self.OneProfMakeFuncs, ())) self.menus.append(idaapi.add_menu_item("Edit/Plugin/", "Sunrace: One prof color trace", "Alt+F1", 0, self.OneProfColor, ())) self.menus.append(idaapi.add_menu_item("Edit/Plugin/", "Sunrace: Two profs make funcs", "Alt+F4", 0, self.TwoProfMakeFuncs, ())) self.menus.append(idaapi.add_menu_item("Edit/Plugin/", "Sunrace: Two profs color trace", "Alt+F2", 0, self.TwoProfColor, ())) self.menus.append(idaapi.add_menu_item("Edit/Plugin/", "Sunrace: Get current funcs view", "Alt+1", 0, self.GetCurrentFuncsView, ())) self.menus.append(idaapi.add_menu_item("Edit/Plugin/", "Sunrace: Clear colors", "Alt+Q", 0, self.ClearColors, ())) self.menus.append(idaapi.add_menu_item("Edit/Plugin/", "Sunrace: REanalyse Colors, plz", "Alt+R", 0, self.REanalyseColors, ())) self.menus.append(idaapi.add_menu_item("Edit/Plugin/", "Sunrace: Exit", "Ctrl+Q", 0, self.term, ())) self.menus.append(idaapi.add_menu_item("Edit/Plugin/", "Sunrace: Quick Help", "Alt+Z", 0, self.QHelp,()))
def init(self): """ Initialize plugin: """ self._client_config = load_config() self._fcc = None if self._client_config is not None: self._fcc = FCatalogClient(\ (self._client_config.remote_host,\ self._client_config.remote_port),\ self._client_config.db_name,\ self._client_config.exclude_pattern) # Make sure that self._client config is built, even if it doesn't have # any fields inside: if self._client_config is None: self._client_config = ClientConfig() # Set up menus: ui_path = "Edit/" self.menu_contexts = [] self.menu_contexts.append(idaapi.add_menu_item(ui_path, "FCatalog: Configure", "", 0, self._show_conf_form, (None,))) self.menu_contexts.append(idaapi.add_menu_item(ui_path, "FCatalog: Commit Functions", "", 0, self._commit_funcs, (None,))) self.menu_contexts.append(idaapi.add_menu_item(ui_path, "FCatalog: Find Similars", "", 0, self._find_similars, (None,))) self.menu_contexts.append(idaapi.add_menu_item(ui_path, "FCatalog: Clean IDB", "", 0, self._clean_idb, (None,))) return idaapi.PLUGIN_KEEP
def init(self): if idc.GetShortPrm(idc.INF_PROCNAME).lower().startswith('mips'): self.menu_context = idaapi.add_menu_item("Options/", "Name saved registers", "Alt-4", 0, self.name_saved_registers, (None,)) else: self.menu_context = None return idaapi.PLUGIN_KEEP
def init(self): # add a menu for Keypatch patcher & assembler menu_ctx = idaapi.add_menu_item("Edit/Keypatch/", "Patcher", "Ctrl-Alt-K", 1, self.patcher, None) if menu_ctx is not None: idaapi.add_menu_item("Edit/Keypatch/", "Assembler", "", 1, self.assembler, None) print("=" * 80) print("Keypatch registered IDA plugin {} (c) Nguyen Anh Quynh & Thanh Nguyen, 2016".format(VERSION)) print("Keypatch is using Keystone v{}".format(keystone.__version__)) print("Keypatch Patcher's shortcut key is CTRL+ALT+K") print("Keypatch Assembler is available from menu Edit | Keypatch | Assembler") print("Find more information about Keypatch at http://keystone-engine.org/keypatch") print("=" * 80) self.kp_asm = Keypatch_Asm() 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 add_menu_item_helper(self, menupath, name, hotkey, flags, pyfunc, args): addmenu_item_ctx = None # add menu item and report on errors if idaapi.IDA_SDK_VERSION >= 700: action_name = name.strip(".") action_label = name action_qname = "IDAPatcher:%s" % action_name action_desc = idaapi.action_desc_t( action_qname, action_label, PatchManager_ah_t(pyfunc), hotkey ) if idaapi.register_action(action_desc): addmenu_item_ctx = idaapi.attach_action_to_menu(menupath, action_qname, idaapi.SETMENU_APP) else: 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
def init(self): # register popup menu handlers try: # Register Auto Fix IDB handler VxHunterMCFixIDB.register(self, "Auto Fix IDB With symbol table") # Register Fix Code handler VxHunterMCFixCode.register(self, "Fix Code from start address to end address") # Register Fix Ascii handler VxHunterMCFixAscii.register(self, "Fix Ascii string table with giving address") except Exception as err: print("Got Error!!!: %s" % err) # setup popup menu if idaapi.IDA_SDK_VERSION >= 700: # Add menu IDA >= 7.0 idaapi.attach_action_to_menu("Edit/VxHunter/", VxHunterMCFixIDB.get_name(), idaapi.SETMENU_APP) idaapi.attach_action_to_menu("Edit/VxHunter/", VxHunterMCFixCode.get_name(), idaapi.SETMENU_APP) idaapi.attach_action_to_menu("Edit/VxHunter/", VxHunterMCFixAscii.get_name(), idaapi.SETMENU_APP) else: # add Vxhunter menu menu = idaapi.add_menu_item("Edit/VxHunter/", "Auto Fix IDB1", "", 1, self.handler_auto_fix_idb, None) if menu is not None: pass print("=" * 80) return idaapi.PLUGIN_KEEP
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 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 add_idaipython_menu(self): try: menu_item = idaapi.add_menu_item('View/', 'IDAIPython QtConsole', '', 0, self.start_qtconsole, tuple()) self.menu_items.append(menu_item) except: self.qtconsole_action = add_idaipython_menu(self.start_qtconsole)
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 add_menu_item(menupath, name, hotkey, flags, pyfunc, args): menuItem = idaapi.add_menu_item(menupath, name, hotkey, flags, pyfunc, args) if menuItem is None: print "Failed to register menu item %s for launching %s!" % ( menupath + "->" + name, pyfunc.__name__) else: print "Menu item %s registered for launching %s" % ( menupath + "->" + name, pyfunc.__name__)
def add_menu_item_helper(self, menupath, name, hotkey, pyfunc, flags=1, args=None): # 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: raise MenuHelperException("Failed adding menu item.") self.addmenu_item_ctxs.append(addmenu_item_ctx)
def _add_menu(self, *args): ctx = idaapi.add_menu_item(*args) if ctx is None: idaapi.msg("Add failed!\n") return False else: self.ctxs.append(ctx) return True
def add_menu_item_helper(self, menupath, name, hotkey, flags, pyfunc, args): # 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
def init(self): r = idaapi.add_menu_item(MENU_PATH, 'Open MSDN Search', '', 1, self.openHelp, tuple()) if r is None: idaapi.msg("IdaMSDNHelp: add menu failed!\n") idaapi.msg( "IdaMSDNHelp: initialized, opening webbrowser with '%s' command\n" % webbrowser.get().name) 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 main(): ex_addmenu_item_ctx = idaapi.add_menu_item('Edit/', 'eliminate dead code', 'Shift-D', 0, create_view, ()) if ex_addmenu_item_ctx is None: print('Failed to add nao!') else: print('nao added successfully.') return True
def add_menu_item_helper(self, menupath, name, hotkey, flags, pyfunc, args): # 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 # Error else: self.addmenu_item_ctxs.append(addmenu_item_ctx) print "[*] Add Menu Item -> %s" % (menupath + name) return 0
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(cls, path, name, callable, hotkey='', flags=0, args=()): '''Register a `callable` as a menu item at the specified `path` with the provided `name`.''' # check to see if our menu item is in our cache and remove it if so if (path, name) in cls.state: cls.rm(path, name) # now we can add the menu item since everything is ok # XXX: I'm not sure if the path needs to be utf8 encoded or not res = internal.utils.string.to(name) ctx = idaapi.add_menu_item(path, res, hotkey, flags, callable, args) cls.state[path, name] = ctx
def init(self): ''' Initialize some default values for class variables. ''' self.gui = None self.idasim = None self.config = None self.functions = {} self.startup_script = '' self.startup_name = None self.stubs = True self.menu_context = idaapi.add_menu_item("Options/", "Simulate functions and code blocks...", "Alt-0", 0, self.run, (None,)) return idaapi.PLUGIN_KEEP
def insert(self, option_groups=[]): if "enable" in option_groups: self.enable_menu_item = idaapi.add_menu_item("FILE/", "Enable IDASynergy for this IDB", "", 0, self.on_enable_plugin, ()) #self.remove_hooks() else: if "svn" in option_groups and self.svn_menuitems == []: self.svn_menuitems.append( idaapi.add_menu_item("FILE/", "IDASynergy SVN Checkout...", "", 0, self.on_checkout, ()) ) self.svn_menuitems.append( idaapi.add_menu_item("FILE/", "IDASynergy SVN Commit...", "CTRL+SHIFT+C", 0, self.on_commit, () )) self.svn_menuitems.append( idaapi.add_menu_item("FILE/", "IDASynergy SVN Update...", "CTRL+SHIFT+U", 0, self.on_update, () )) if "full" in option_groups and self.ex_addmenu_item_ctx == []: self.ex_addmenu_item_ctx.append( idaapi.add_menu_item("Options/", "IDASynergy...", "", 0, self.on_config, ()) ) self.ex_addmenu_item_ctx.append( idaapi.add_menu_item("FILE/", "IDASynergy Load from local repository", "", 0, self.on_import_all, ()) ) self.ex_addmenu_item_ctx.append( idaapi.add_menu_item("FILE/", "IDASynergy Export analysis to file", "", 0, self.on_export, ()) ) self.ex_addmenu_item_ctx.append( idaapi.add_menu_item("FILE/", "IDASynergy Import analysis from file", "", 0, self.on_import, ())) #self.insert_hooks() self.remove(["enable"])
def init(): NO_HOTKEY = "" SETMENU_INS = 0 NO_ARGS = tuple() menu = idaapi.add_menu_item( "Options/", "{} Config".format(Config.PLUGIN_NAME), NO_HOTKEY, SETMENU_INS, Config.stingray_config, NO_ARGS ) if menu is None: del menu Config.MENU_CONTEXT = menu Config.load()
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): idaapi.msg("apply_callee_type_plugin:init\n") idaapi.require("flare") idaapi.require("flare.apply_callee_type") idaapi.require("flare.jayutils") # hack -> stashing a flag under idaapi to prevent multiple menu items from appearing if hasattr(sys.modules["idaapi"], "_apply_callee_type_plugin_installFlag"): # print 'Skipping menu install: already present' pass else: self.ex_addmenu_item_ctx = idaapi.add_menu_item( "Edit/Operand type/Manual", "ApplyCalleeType", "Alt-J", 0, doApplyCallee, tuple("hello world") ) if self.ex_addmenu_item_ctx is None: print "Failed to init apply_callee_type_plugin" setattr(sys.modules["idaapi"], "_apply_callee_type_plugin_installFlag", True) return idaapi.PLUGIN_OK
def add(cls, path, name, fn, hotkey='', flags=0, args=()): if (path,name) in cls.state: cls.rm(path, name) ctx = idaapi.add_menu_item(path, name, hotkey, flags, fn, args) cls.state[path,name] = ctx
def AddMenuElements(self): idaapi.add_menu_item("View/", "PIP", "", 0, self.Toast, ())
def init(self): self.menu_context = idaapi.add_menu_item("Options/", "Fixup code", "", 0, self.fix_code, (None,)) self.menu_context = idaapi.add_menu_item("Options/", "Fixup data", "", 0, self.fix_data, (None,)) return idaapi.PLUGIN_KEEP
return 1 # Add menu item try: if ctx: idaapi.del_menu_item(ctx) except: pass dir_list = os.listdir(TEMPLATE_DIR) for fname in dir_list: if fname.endswith(VALID_TEMPLATE_EXT): f = open(TEMPLATE_DIR+"/"+fname,"r") temp_data = f.read() template_dict[fname]=temp_data for template in template_dict: ctx = idaapi.add_menu_item("Edit/Plugins/", "CTemplate > "+template, "", 0, go_callback, tuple(template)) if ctx is None: print "Failed to add menu!" del ctx else: print "Menu added successfully!"
# MakeComm(sEA,"Test Comment") SetFunctionCmt(sEA, "Test Comment", 0) ##graph() def go_callback(*args): go() return 1 # IDA binds hotkeys to IDC functions so a trampoline IDC function must be created idaapi.CompileLine('static flopy_key() { RunPythonStatement("on_hotkey()"); }') add_idc_hotkey(hotkey_str, "flopy_key") idaapi.CompileLine('static flopy_click() { RunPythonStatement("on_click()"); }') add_idc_hotkey(hotkey_str2, "flopy_click") # Add menu item try: if ctx: idaapi.del_menu_item(ctx) except: pass ctx = idaapi.add_menu_item("Search/", "Go", "", 0, go_callback, tuple("hello world")) if ctx is None: print "Failed to add menu!" del ctx else: print "Menu added successfully!"