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
예제 #2
0
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
예제 #3
0
    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
예제 #4
0
 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")
예제 #5
0
    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
예제 #6
0
def graph_zoom_fit():
    idaapi.process_ui_action('GraphZoomFit')
예제 #7
0
def graph_zoom_100():
    idaapi.process_ui_action('GraphZoom100')
예제 #8
0
    def activate(self, ctx):
        action = fuzzy_search_main()

        if action:
            idaapi.process_ui_action(action)
        return 1
예제 #9
0
def clear_output_window():
    idaapi.process_ui_action("msglist:Clear")
예제 #10
0
def load_clr_file(filepath):
    event_filter = TemporaryFilter(filepath)
    qApp.installEventFilter(event_filter)

    return idaapi.process_ui_action('SetColors')
예제 #11
0
 def fun():
     idaapi.update_action_state("GraphLayout", 0)
     idaapi.process_ui_action("GraphLayout")
예제 #12
0
 def activate(self, ctx):
     global last_command
     return idaapi.process_ui_action(last_command)
예제 #13
0
    def activate(self, ctx):
        action = AskForAction()

        if action:
            idaapi.process_ui_action(action)
        return 1
예제 #14
0
        #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)
예제 #15
0
def load_clr_file(filepath):
    event_filter = TemporaryFilter(filepath)
    qApp.installEventFilter(event_filter)

    return idaapi.process_ui_action('SetColors')