def gui_action_callback(self, vu): cfunc = vu.cfunc.__deref__() if not vu.get_current_item(idaapi.USE_KEYBOARD): print "Force lvar width: you don't have anything selected" return False badlv = vu.item.get_lvar() if not badlv: print "Force lvar width: you don't have an lvar selected" return False new_width = idc.AskLong(badlv.width, "Enter the new width for " + badlv.name) if new_width == None: # cancelled print "Force lvar width: operation cancelled" return False if new_width <= 0: print "Force lvar width: not allowed. Non-positive width will crash IDA" return False badlv.set_width(new_width) print 'Set the type in IDA (Y) for it to apply' idaapi.process_ui_action('hx:SetType') # vu.refresh_ctext() print 'Force lvar width: OK.' return True
def get_selected_text(): """ Get the highlight text. If none, force IDA copy text and we will get from clipboard """ text = "" old_text = clip_text() view = idaapi.get_current_viewer() if view: thing = ida_kernwin.get_highlight(view) if thing and thing[1]: text = thing[0] # We not have a highlight text if not text: for action in idaapi.get_registered_actions(): if "Copy" in action: shortcut = idaapi.get_action_shortcut(action) state = idaapi.get_action_state(action) if ("Ctrl-C" in shortcut) and (state and state[0] and (state[1] <= idaapi.AST_ENABLE)): idaapi.process_ui_action(action) text = clip_text() if text != old_text: break if not text: plg_print("Could not get any highlight/auto copied text\n" \ "Search with old clipboard text: '%s'" % old_text) text = old_text return text
def __call__(self): if self.__idx >= len(self.__action_list): return False # Execute one action idaapi.process_ui_action(self.__action_list[self.__idx], self.__flags) # Move to next action self.__idx += 1 # Reschedule return True
def clear_output_window(): if Util.is_ida70(): from PyQt5 import QtGui, QtCore, QtWidgets form = idaapi.find_tform("Output window") w = idaapi.PluginForm.FormToPyQtWidget(form) w.setFocus() else: from PySide import QtGui, QtCore form = idaapi.find_tform("Output window") w = idaapi.PluginForm.FormToPySideWidget(form) w.setFocus() idaapi.process_ui_action("msglist:Clear")
def __call__(self): if self.__idx >= len(self.__action_list): return False # Execute one action idaapi.process_ui_action(self.__action_list[self.__idx], self.__flags) # Move to next action self.__idx += 1 print "index=%d" % self.__idx # Reschedule return True
def graph_zoom_fit(): idaapi.process_ui_action('GraphZoomFit')
def graph_zoom_100(): idaapi.process_ui_action('GraphZoom100')
def activate(self, ctx): action = fuzzy_search_main() if action: idaapi.process_ui_action(action) return 1
def clear_output_window(): idaapi.process_ui_action("msglist:Clear")
def load_clr_file(filepath): event_filter = TemporaryFilter(filepath) qApp.installEventFilter(event_filter) return idaapi.process_ui_action('SetColors')
def fun(): idaapi.update_action_state("GraphLayout", 0) idaapi.process_ui_action("GraphLayout")
def activate(self, ctx): global last_command return idaapi.process_ui_action(last_command)
def activate(self, ctx): action = AskForAction() if action: idaapi.process_ui_action(action) return 1
#patch format vul if bfind_puts == True: printf_addr = search_printf_instr(func) if printf_addr != []: for addr in printf_addr: patch_call_printf(addr) return if __name__ == '__main__': #清空输出窗口 form = idaapi.find_tform("Output window") idaapi.switchto_tform(form, True) idaapi.process_ui_action("msglist:Clear") #save to file path = os.path.abspath(__file__) path = os.path.realpath(__file__) path = os.path.dirname(path) # target_path = idc.GetInputFilePath() target_file = idc.GetInputFile() if idaapi.init_hexrays_plugin(): #print("Hex-rays version %s has been detected" % idaapi.get_hexrays_version()) pass else: load_plugin_decompiler(is_bit64)
def load_clr_file(filepath): event_filter = TemporaryFilter(filepath) qApp.installEventFilter(event_filter) return idaapi.process_ui_action('SetColors')