本文整理汇总了Python中ida_kernwin.action_desc_t方法的典型用法代码示例。如果您正苦于以下问题:Python ida_kernwin.action_desc_t方法的具体用法?Python ida_kernwin.action_desc_t怎么用?Python ida_kernwin.action_desc_t使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ida_kernwin
的用法示例。
在下文中一共展示了ida_kernwin.action_desc_t方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OnPopup
# 需要导入模块: import ida_kernwin [as 别名]
# 或者: from ida_kernwin import action_desc_t [as 别名]
def OnPopup(self, form, popup_handle):
# graph closer
actname = 'graph_closer:{}'.format(self.title)
desc = ida_kernwin.action_desc_t(
actname, 'Close: {}'.format(self.title), GraphCloser(self))
ida_kernwin.attach_dynamic_action_to_popup(form, popup_handle, desc)
# color changer
actname = 'color_changer:{}'.format(self.title)
desc = ida_kernwin.action_desc_t(
actname, 'Change colors: {}'.format(self.title), ColorChanger(self))
ida_kernwin.attach_dynamic_action_to_popup(form, popup_handle, desc)
# selection printer
actname = 'selection_printer:{}'.format(self.title)
desc = ida_kernwin.action_desc_t(
actname, 'Print selection: {}'.format(self.title), SelectionPrinter(self))
ida_kernwin.attach_dynamic_action_to_popup(form, popup_handle, desc)
示例2: editor_menuaction
# 需要导入模块: import ida_kernwin [as 别名]
# 或者: from ida_kernwin import action_desc_t [as 别名]
def editor_menuaction(self):
action_desc = ida_kernwin.action_desc_t(
'my:editoraction', # The action name. This acts like an ID and must be unique
'Python Editor!', # The action text.
MyEditorHandler(), # The action handler.
'Ctrl+H', # Optional: the action shortcut DO IT HERE!
'Script editor', # Optional: the action tooltip (available in menus/toolbar)
ida_kernwin.load_custom_icon(":/ico/python.png") # hackish load action icon , if no custom icon use number from 1-150 from internal ida
)
# 3) Register the action
ida_kernwin.register_action(action_desc)
ida_kernwin.attach_action_to_menu(
'Edit/Editor...', # The relative path of where to add the action
'my:editoraction', # The action ID (see above)
ida_kernwin.SETMENU_APP) # We want to append the action after the 'Manual instruction...
form = ida_kernwin.get_current_tform()
ida_kernwin.attach_action_to_popup(form, None, "my:editoraction", None)
示例3: init_hooks
# 需要导入模块: import ida_kernwin [as 别名]
# 或者: from ida_kernwin import action_desc_t [as 别名]
def init_hooks(idausr):
_setter = IdausrTemporarySetter(idausr)
class ActionHandler(ida_kernwin.action_handler_t):
def __init__(self, handler):
ida_kernwin.action_handler_t.__init__(self)
self.handler = handler
def activate(self, ctx):
with _setter:
self.handler()
def update(self, ctx):
return ida_kernwin.AST_ENABLE_ALWAYS
for name, label, handler, before in _HOOKS:
if ida_kernwin.unregister_action(name):
action = ida_kernwin.action_desc_t(name, label, ActionHandler(handler))
ida_kernwin.register_action(action)
ida_kernwin.attach_action_to_menu(before, name, ida_kernwin.SETMENU_INS)
示例4: main
# 需要导入模块: import ida_kernwin [as 别名]
# 或者: from ida_kernwin import action_desc_t [as 别名]
def main():
show_banner()
print "Unregistering old action..."
ida_kernwin.unregister_action(ACTION_NAME)
if ida_hexrays.init_hexrays_plugin():
ida_kernwin.register_action(
ida_kernwin.action_desc_t(
ACTION_NAME,
"Keep sanity (stack strings)",
stack_strings_ah_t(),
None))
print "Registered new action"
idaapi.install_hexrays_callback(cb)
else:
print "[x] No decompiler found!"
return
示例5: OnPopup
# 需要导入模块: import ida_kernwin [as 别名]
# 或者: from ida_kernwin import action_desc_t [as 别名]
def OnPopup(self, form, popup_handle):
actname = "choose:actFnFuzzyImport"
desc = ida_kernwin.action_desc_t(actname, 'Import function name and prototype', import_handler_t(self.items, self.idb_path, self.title))
ida_kernwin.attach_dynamic_action_to_popup(form, popup_handle, desc)
示例6: install
# 需要导入模块: import ida_kernwin [as 别名]
# 或者: from ida_kernwin import action_desc_t [as 别名]
def install(self):
action_name = self.__class__.__name__
# Read and load the icon file
icon_data = open(self._icon, "rb").read()
self._icon_id = ida_kernwin.load_custom_icon(data=icon_data)
# Create the action descriptor
action_desc = ida_kernwin.action_desc_t(
self._ACTION_ID,
self._text,
self._handler,
None,
self._tooltip,
self._icon_id,
)
# Register the action using its descriptor
result = ida_kernwin.register_action(action_desc)
if not result:
raise RuntimeError("Failed to register action %s" % action_name)
# Attach the action to the chosen menu
result = ida_kernwin.attach_action_to_menu(
self._menu, self._ACTION_ID, ida_kernwin.SETMENU_APP
)
if not result:
action_name = self.__class__.__name__
raise RuntimeError("Failed to install action %s" % action_name)
self._plugin.logger.debug("Installed action %s" % action_name)
return True
示例7: get_desc
# 需要导入模块: import ida_kernwin [as 别名]
# 或者: from ida_kernwin import action_desc_t [as 别名]
def get_desc(self):
return ida_kernwin.action_desc_t(
self.get_id(),
self.get_text(),
self,
self.get_shortcut(),
self.get_tooltip(),
self.get_icon())
示例8: register_action
# 需要导入模块: import ida_kernwin [as 别名]
# 或者: from ida_kernwin import action_desc_t [as 别名]
def register_action(name, shortcut=''):
def handler(f):
# 1) Create the handler class
class MyHandler(ida_kernwin.action_handler_t):
def __init__(self):
ida_kernwin.action_handler_t.__init__(self)
# Say hello when invoked.
def activate(self, ctx):
t = threading.Thread(target=f)
t.start()
return 1
# This action is always available.
def update(self, ctx):
return ida_kernwin.AST_ENABLE_ALWAYS
# 2) Describe the action
action_desc = ida_kernwin.action_desc_t(
name, # The action name. This acts like an ID and must be unique
name, # The action text.
MyHandler(), # The action handler.
shortcut, # Optional: the action shortcut
name, # Optional: the action tooltip (available in menus/toolbar)
0) # Optional: the action icon (shows when in menus/toolbars)
# 3) Register the action
ida_kernwin.register_action(action_desc)
return f
return handler