本文整理汇总了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
示例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
示例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)
示例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
示例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
# ------------------------------------------------------------
示例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)
示例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
示例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)
示例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
示例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))
示例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)
#------------------------------------------------------------------------------
示例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
示例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
示例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)
示例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