예제 #1
0
 def dbg_bpt(self, tid, ea):
     Registers = StartHandler(REGS_WIDGET_TITLE)
     Registers.activate(None)
     Stack = StartHandler(STACK_WIDGET_TITLE)
     Stack.activate(None)
     idaapi.activate_widget(idaapi.find_widget("IDA View-EIP"), True)
     return 0
예제 #2
0
    def _touch_ida_window(self, target):
        """
        Touch a window/widget/form to ensure it gets drawn by IDA.

        XXX/HACK:

          We need to ensure that widget we will analyze actually gets drawn
          so that there are colors for us to steal.

          To do this, we switch to it, and switch back. I tried a few different
          ways to trigger this from Qt, but could only trigger the full
          painting by going through the IDA routines.

        """

        # get the currently active widget/form title (the form itself seems transient...)
        twidget = idaapi.get_current_widget()
        title = idaapi.get_widget_title(twidget)

        # touch the target window by switching to it
        idaapi.activate_widget(target, True)
        flush_qt_events()

        # locate our previous selection
        previous_twidget = idaapi.find_widget(title)

        # return us to our previous selection
        idaapi.activate_widget(previous_twidget, True)
        flush_qt_events()
예제 #3
0
 def activate(self, ctx):
     tform = idaapi.find_widget('Classes')
     if not tform:
         class_viewer = ClassViewer(classes.ProxyModel(),
                                    classes.TreeModel())
         class_viewer.Show()
     else:
         idaapi.activate_widget(tform, True)
예제 #4
0
def init():
    """It colors the database, loads capa explorer (running its analysis) and reactivate the `IDA View-A` view.
    Call this method after IDA initial autoanalysis has been finished."""
    color.apply()
    ida_loader.load_and_run_plugin("capa_explorer", 1)  # 1 = analyze
    widget = idaapi.find_widget("IDA View-A")
    if widget:
        idaapi.activate_widget(widget, True)
    print("ANA: Initialization finished")
예제 #5
0
def touch_window(target):
    """
    Touch a window/widget/form to ensure it gets drawn by IDA.

    XXX/HACK:

      We need to ensure that widget we will analyze actually gets drawn
      so that there are colors for us to steal.

      To do this, we switch to it, and switch back. I tried a few different
      ways to trigger this from Qt, but could only trigger the full
      painting by going through the IDA routines.

    """

    # get the currently active widget/form title (the form itself seems transient...)
    if using_ida7api:
        twidget = idaapi.get_current_widget()
        title = idaapi.get_widget_title(twidget)
    else:
        form = idaapi.get_current_tform()
        title = idaapi.get_tform_title(form)

    # touch/draw the widget by playing musical chairs
    if using_ida7api:

        # touch the target window by switching to it
        idaapi.activate_widget(target, True)
        flush_ida_sync_requests()

        # locate our previous selection
        previous_twidget = idaapi.find_widget(title)

        # return us to our previous selection
        idaapi.activate_widget(previous_twidget, True)
        flush_ida_sync_requests()

    else:

        # touch the target window by switching to it
        idaapi.switchto_tform(target, True)
        flush_ida_sync_requests()

        # locate our previous selection
        previous_form = idaapi.find_tform(title)

        # lookup our original form and switch back to it
        idaapi.switchto_tform(previous_form, True)
        flush_ida_sync_requests()
예제 #6
0
 def retrieve_function_callback(self, __, ea=None):
     func_ea = idaapi.get_screen_ea() if ea is None else ea
     func_name = idaapi.get_func_name(func_ea)
     widget_title = "{} - {}".format(self.name, func_name)
     widget = idaapi.find_widget(widget_title)
     if widget:
         idaapi.activate_widget(widget, True)
         return
     targets = self.retrieve_function(func_ea, self.cfg['topk'])
     if targets is None:
         print("[{}] {} is skipped because get function feature error".format(self.name, func_name))
         return
     cv = SourceCodeViewer(func_name, targets)
     cv.Create(widget_title)
     cv.refresh()
     # CDVF_STATUSBAR 0x04, keep the status bar in the custom viewer
     cv = idaapi.create_code_viewer(cv.GetWidget(), 0x4)
     idaapi.set_code_viewer_is_source(cv)
     idaapi.display_widget(cv, idaapi.PluginForm.WOPN_DP_TAB | idaapi.PluginForm.WOPN_RESTORE)
     ida_kernwin.refresh_navband(True)
예제 #7
0
 def jumpto_in_view(self, view, ea):
     idaapi.activate_widget(view, True)
     return idaapi.jumpto(ea)
예제 #8
0
 def activate(self, ctx):
     tform = idaapi.find_widget("Structure Builder")
     if tform:
         idaapi.activate_widget(tform, True)
     else:
         StructureBuilder(cache.temporary_structure).Show()