當前位置: 首頁>>代碼示例>>Python>>正文


Python idaapi.find_widget方法代碼示例

本文整理匯總了Python中idaapi.find_widget方法的典型用法代碼示例。如果您正苦於以下問題:Python idaapi.find_widget方法的具體用法?Python idaapi.find_widget怎麽用?Python idaapi.find_widget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在idaapi的用法示例。


在下文中一共展示了idaapi.find_widget方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: ida_get_cfg_raw

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import find_widget [as 別名]
def ida_get_cfg_raw(existing_cfg=None):
    if "idaapi" not in sys.modules:
        print("ERROR: idaapi not loaded")
        return None
    
    import idaapi
    tw = idaapi.find_widget("IDAgrap")
    if tw is not None:
        import idagrap
        # Get CFG from existing loaded IDAgrap
        w = idaapi.PluginForm.FormToPyQtWidget(tw)
        pgw=w.findChild(idagrap.ui.widgets.PatternGenerationWidget.PatternGenerationWidget)
        cfg = pgw.cc.PatternGenerator.graph
        return cfg, True
    else:
        # If necessary, load grap and creates new CFG object
        if existing_cfg is None:
            fp, pathname, description = imp.find_module("grap")
            _mod = imp.load_module("grap", fp, pathname, description)
            cfg = _mod.CFG()
            return cfg, False
        return existing_cfg, False 
開發者ID:AirbusCyber,項目名稱:grap,代碼行數:24,代碼來源:ida_helper.py

示例2: _make_unique_title

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import find_widget [as 別名]
def _make_unique_title(self, title):
        """Make the title unique.

        Adds a counter to the title to prevent duplicates.

        Prior to IDA 6.8, two graphs with the same title could crash IDA.
        This has been fixed (https://www.hex-rays.com/products/ida/6.8/index.shtml).
        The code will not change for support of older versions and as it is
        more usable this way.
        """
        unique_title = title

        for counter in itertools.count():
            unique_title = "{}-{}".format(title, counter)
            if not idaapi.find_widget(unique_title):
                break

        return unique_title 
開發者ID:tmr232,項目名稱:Sark,代碼行數:20,代碼來源:ui.py

示例3: set_window_position

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import find_widget [as 別名]
def set_window_position(self):
        ref_widgets = [
            ("Modules",       idaapi.DP_TOP),
            ("Threads",       idaapi.DP_TOP),
            ("IDA View-EIP",  idaapi.DP_RIGHT),
            ("Stack view",    idaapi.DP_TOP)
        ]
        plug_window_name = "Registers - %s" % PLUGIN_NAME
        regs_widget = idaapi.find_widget("General registers")

        if regs_widget:
            idaapi.set_dock_pos(REGS_WIDGET_TITLE, "General registers", idaapi.DP_INSIDE)
            #idaapi.close_widget(regs_widget, 0)
        else:
            found = False
            for wname, pos in ref_widgets:
                if idaapi.find_widget(wname):
                    idaapi.set_dock_pos(REGS_WIDGET_TITLE, wname, pos)
                    found = True
                    break
            if not found:
                idaapi.set_dock_pos(REGS_WIDGET_TITLE, None, idaapi.DP_FLOATING) 
開發者ID:danigargu,項目名稱:deREferencing,代碼行數:24,代碼來源:registers.py

示例4: highlight_symbol_in_DISASM

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import find_widget [as 別名]
def highlight_symbol_in_DISASM():
    """
    Select a symbol in the DECOMP view,
    highlight the corresponding symbols in IDA DISASM view.
    """
    # print("GhIDA:: [DEBUG] highlight_symbol_in_DISASM called")
    disasm_widget = idaapi.find_widget('IDA View-A')

    symbol = None
    ret = ida_kernwin.get_highlight(ida_kernwin.get_current_viewer())
    if ret and ret[1]:
        symbol = ret[0]

    if not symbol:
        # TODO improve it
        # Highlight a non-existing symbole
        idaapi.set_highlight(disasm_widget, 'aaabbbccc', 1)
        return True

    converted_symbol = from_ghidra_to_ida_syntax_conversion(symbol)
    if converted_symbol:
        # Update IDA DISASM view
        idaapi.set_highlight(disasm_widget, converted_symbol, 1)
    else:
        # TODO improve it
        # Highlight a non-existing symbole
        idaapi.set_highlight(disasm_widget, 'aaabbbccc', 1)
    return True 
開發者ID:Cisco-Talos,項目名稱:GhIDA,代碼行數:30,代碼來源:ui.py

示例5: highlight_symbol_in_DECOMP

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import find_widget [as 別名]
def highlight_symbol_in_DECOMP():
    """
    Select a symbol in the IDA DISASM view,
    highlight the corresponding symbol in DECOMP view.
    """
    # print("GhIDA:: [DEBUG] highlight_symbol_in_DECOMP called")
    symbol = None
    ret = ida_kernwin.get_highlight(ida_kernwin.get_current_viewer())
    if ret and ret[1]:
        symbol = ret[0]

    if not symbol:
        return

    converted_symbol = from_ida_to_ghidra_syntax_conversion(symbol)
    decompiler_widget = idaapi.find_widget('Decompiled Function')
    if converted_symbol:
        # Update IDA DECOMP view
        idaapi.set_highlight(decompiler_widget, converted_symbol, 1)
    else:
        idaapi.set_highlight(decompiler_widget, 'aaabbbccc', 1)
    return


# ------------------------------------------------------------
#   RENAME SYMBOLS FORM & utils
# ------------------------------------------------------------ 
開發者ID:Cisco-Talos,項目名稱:GhIDA,代碼行數:29,代碼來源:ui.py

示例6: get_widget

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import find_widget [as 別名]
def get_widget(title):
    """Get the Qt widget of the IDA window with the given title."""
    tform = idaapi.find_widget(title)
    if not tform:
        raise exceptions.FormNotFound("No form titled {!r} found.".format(title))

    return idaapi.PluginForm.FormToPyQtWidget(tform) 
開發者ID:tmr232,項目名稱:Sark,代碼行數:9,代碼來源:qt.py

示例7: get_window

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import find_widget [as 別名]
def get_window():
    """Get IDA's top level window."""
    tform = idaapi.get_current_widget()

    # Required sometimes when closing IDBs and not IDA.
    if not tform:
        tform = idaapi.find_widget("Output window")

    widget = idaapi.PluginForm.FormToPyQtWidget(tform)
    window = widget.window()
    return window 
開發者ID:tmr232,項目名稱:Sark,代碼行數:13,代碼來源:qt.py

示例8: get_selected_funcs

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import find_widget [as 別名]
def get_selected_funcs():
    """
    Return the list of function names selected in the Functions window.
    """
    import sip
    twidget = idaapi.find_widget("Functions window")
    widget  = sip.wrapinstance(int(twidget), QtWidgets.QWidget)

    # TODO: test this
    if not widget:
        idaapi.warning("Unable to find 'Functions window'")
        return

    #
    # locate the table widget within the Functions window that actually holds
    # all the visible function metadata
    #

    table = widget.findChild(QtWidgets.QTableView)

    #
    # scrape the selected function names from the Functions window table
    #

    selected_funcs = [str(s.data()) for s in table.selectionModel().selectedRows()]

    #
    # re-map the scraped names as they appear in the function table, to their true
    # names as they are saved in the IDB. See the match_funcs(...) function
    # comment for more details
    #

    return match_funcs(selected_funcs) 
開發者ID:gaasedelen,項目名稱:prefix,代碼行數:35,代碼來源:ida_prefix.py

示例9: show_dockable

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import find_widget [as 別名]
def show_dockable(self, dockable_name):
        try:
            make_dockable = self._dockable_factory[dockable_name]
        except KeyError:
            return False

        parent, dctx = None, None # not used for IDA's integration
        widget = make_dockable(dockable_name, parent, dctx)

        # get the original twidget, so we can use it with the IDA API's
        #twidget = idaapi.TWidget__from_ptrval__(widget) NOTE: IDA 7.2+ only...
        twidget = self._dockable_widgets.pop(dockable_name)
        if not twidget:
            self.warning("Could not open dockable window, because its reference is gone?!?")
            return

        # show the dockable widget
        flags = idaapi.PluginForm.WOPN_TAB | idaapi.PluginForm.WOPN_RESTORE | idaapi.PluginForm.WOPN_PERSIST
        idaapi.display_widget(twidget, flags)
        widget.visible = True

        # attempt to 'dock' the widget in a reasonable location
        for target in ["IDA View-A", "Pseudocode-A"]:
            dwidget = idaapi.find_widget(target)
            if dwidget:
                idaapi.set_dock_pos(dockable_name, 'IDA View-A', idaapi.DP_RIGHT)
                break 
開發者ID:gaasedelen,項目名稱:lighthouse,代碼行數:29,代碼來源:ida_api.py

示例10: _get_ida_bg_color_from_view

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import find_widget [as 別名]
def _get_ida_bg_color_from_view(self):
        """
        Get the background color of the IDA disassembly views via widget inspection.
        """
        logger.debug("Attempting to get IDA disassembly background color from view...")

        names  = ["Enums", "Structures"]
        names += ["Hex View-%u" % i for i in range(5)]
        names += ["IDA View-%c" % chr(ord('A') + i) for i in range(5)]

        # find a form (eg, IDA view) to analyze colors from
        for window_name in names:
            twidget = idaapi.find_widget(window_name)
            if twidget:
                break
        else:
            logger.debug(" - Failed to find donor view...")
            return None

        # touch the target form so we know it is populated
        self._touch_ida_window(twidget)

        # locate the Qt Widget for a form and take 1px image slice of it
        import sip
        widget = sip.wrapinstance(int(twidget), QtWidgets.QWidget)
        pixmap = widget.grab(QtCore.QRect(0, 10, widget.width(), 1))

        # convert the raw pixmap into an image (easier to interface with)
        image = QtGui.QImage(pixmap.toImage())

        # return the predicted background color
        return QtGui.QColor(predict_bg_color(image)) 
開發者ID:gaasedelen,項目名稱:lighthouse,代碼行數:34,代碼來源:ida_api.py

示例11: _touch_ida_window

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import find_widget [as 別名]
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()

#------------------------------------------------------------------------------
# Disassembler Context API (database-specific)
#------------------------------------------------------------------------------ 
開發者ID:gaasedelen,項目名稱:lighthouse,代碼行數:35,代碼來源:ida_api.py

示例12: find_disass_view

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import find_widget [as 別名]
def find_disass_view(self):
        widget = idaapi.find_widget('IDA View-%s' % dbg.registers.pc)
        if widget:
            return widget

        for c in map(chr, range(65, 75)):
            widget = idaapi.find_widget('IDA View-%s' % c)
            if widget:
                return widget
        return None 
開發者ID:danigargu,項目名稱:deREferencing,代碼行數:12,代碼來源:custom.py

示例13: find_hex_view

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import find_widget [as 別名]
def find_hex_view(self):
        for i in range(1, 10):
            widget = idaapi.find_widget('Hex View-%d' % i)
            if widget:
                return widget
        return None 
開發者ID:danigargu,項目名稱:deREferencing,代碼行數:8,代碼來源:custom.py

示例14: set_window_position

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import find_widget [as 別名]
def set_window_position(self):
        stack_view = idaapi.find_widget("Stack view")
        if stack_view:
            idaapi.set_dock_pos(STACK_WIDGET_TITLE, "Stack view", idaapi.DP_INSIDE)
            #idaapi.close_widget(stack_view, 0)
        else:
            idaapi.set_dock_pos(STACK_WIDGET_TITLE, REGS_WIDGET_TITLE, idaapi.DP_BOTTOM) 
開發者ID:danigargu,項目名稱:deREferencing,代碼行數:9,代碼來源:stack.py

示例15: activate

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import find_widget [as 別名]
def activate(self, ctx):
        if self.widget_title == REGS_WIDGET_TITLE:
            if idaapi.find_widget(self.widget_title) is None:
                w = RegsFlagsViewer()
                w.Show(REGS_WIDGET_TITLE)
                w.set_window_position()

        elif self.widget_title == STACK_WIDGET_TITLE:
            if idaapi.find_widget(self.widget_title) is None:
                w = StackViewer()
                w.Create(STACK_WIDGET_TITLE)
                w.Show()
                w.set_window_position()
        return 1 
開發者ID:danigargu,項目名稱:deREferencing,代碼行數:16,代碼來源:dereferencing.py


注:本文中的idaapi.find_widget方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。