本文整理汇总了Python中idaapi.tag_remove方法的典型用法代码示例。如果您正苦于以下问题:Python idaapi.tag_remove方法的具体用法?Python idaapi.tag_remove怎么用?Python idaapi.tag_remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idaapi
的用法示例。
在下文中一共展示了idaapi.tag_remove方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_comments
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import tag_remove [as 别名]
def add_comments(self, comment_list):
"""
Updated the view with the available comments
"""
for item in comment_list:
lineno = item[0]
comment = item[1]
if len(comment) == 0:
continue
line = self.GetLine(lineno)
if not line:
print("GhIDA:: [!] line not found")
continue
line_text = line[0]
if not line_text:
print("GhIDA:: [!] line-text not found")
continue
line_text = idaapi.tag_remove(line_text) + comment
new_line = self.color_line(line_text)
self.EditLine(lineno, new_line)
self.Refresh()
print("GhIDA:: [DEBUG] updated comments terminated")
return
示例2: callback
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import tag_remove [as 别名]
def callback(self, event, *args):
if event == idaapi.hxe_populating_popup:
form, phandle, vu = args
if vu.item.citype == idaapi.VDI_FUNC or (vu.item.citype == idaapi.VDI_EXPR and vu.item.e.is_expr() and vu.item.e.type.is_funcptr()):
idaapi.attach_action_to_popup(form, phandle, ACTION_HX_REMOVERETTYPE, None)
elif event == idaapi.hxe_double_click:
vu, shift_state = args
# auto jump to target if clicked item is xxx->func();
if vu.item.citype == idaapi.VDI_EXPR and vu.item.e.is_expr():
expr = idaapi.tag_remove(vu.item.e.print1(None))
if "->" in expr:
# find target function
name = expr.split("->")[-1]
addr = idc.get_name_ea_simple(name)
if addr == idaapi.BADADDR:
# try class::function
e = vu.item.e
while e.x:
e = e.x
addr = idc.get_name_ea_simple("%s::%s" % (str(e.type).split()[0], name))
if addr != idaapi.BADADDR:
idc.jumpto(addr)
return 1
return 0
示例3: decompile
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import tag_remove [as 别名]
def decompile(cls, ea):
'''(UNSTABLE) Returns the decompiled code of the basic block at the address `ea`.'''
source = idaapi.decompile(ea)
res = itertools.imap(functools.partial(operator.__getitem__, source.eamap), cls.iterate(ea))
res = itertools.chain(*res)
formatted = reduce(lambda t, c: t if t[-1].ea == c.ea else t+[c], res, [next(res)])
res = []
# FIXME: This has been pretty damn unstable in my tests.
try:
for fmt in formatted:
res.append( fmt.print1(source.__deref__()) )
except TypeError: pass
res = itertools.imap(idaapi.tag_remove, res)
return '\n'.join(map(utils.string.of, res))
示例4: switch_value
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import tag_remove [as 别名]
def switch_value(self):
lineno = self.GetLineNo()
if lineno > len(dbg.registers.flags):
return
line = self.GetLine(lineno)
line = idaapi.tag_remove(line[0])
flag = line[:4].strip()
new_val = not self.flag_vals[flag]
rc = idc.set_reg_value(int(new_val), flag)
if not rc:
idaapi.warning("Unable to update the register value")
return
self.parent.reload_view()
示例5: op_repr
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import tag_remove [as 别名]
def op_repr(ea, opnum):
'''Returns the representation for the operand `opnum` belonging to the instruction at the address `ea`.'''
insn = at(ea)
oppr = idaapi.ua_outop2 if idaapi.__version__ < 7.0 else idaapi.print_operand
outop = utils.fcompose(idaapi.ua_outop2, idaapi.tag_remove) if idaapi.__version__ < 7.0 else utils.fcompose(idaapi.print_operand, idaapi.tag_remove)
try:
res = outop(insn.ea, opnum) or "{:s}".format(op(insn.ea, opnum))
except:
logging.warn(u"{:s}({:#x}, {:d}) : Unable to strip tags from operand \"{:s}\". Returning the result from {:s} instead.".format('.'.join((__name__, 'op_repr')), ea, opnum, utils.string.escape(oppr(insn.ea, opnum), '"'), '.'.join((__name__, 'op'))))
return u"{!s}".format(op(insn.ea, opnum))
return utils.string.of(res)
示例6: get_current_word
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import tag_remove [as 别名]
def get_current_word(self):
word = self.GetCurrentWord()
if word:
word = idaapi.tag_remove(word)
return word
示例7: get_selected_reg
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import tag_remove [as 别名]
def get_selected_reg(self):
reg = None
lineno = self.GetLineNo()
if lineno > len(dbg.registers)-1:
return reg
line = self.GetLine(lineno)
if line and len(line) > 0:
line_str = idaapi.tag_remove(line[0])
reg = line_str[1:dbg.registers.max_len+2].strip()
return reg
示例8: add_comment
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import tag_remove [as 别名]
def add_comment(self):
"""
Add a commment to the selected line
"""
print("GhIDA:: [DEBUG] add_comment called")
colored_line = self.GetCurrentLine(notags=1)
if not colored_line:
idaapi.warning("Select a line")
return False
# Use pygments to parse the line to check if there are comments
line = idaapi.tag_remove(colored_line)
lexer = CLexer()
tokens = list(lexer.get_tokens(line))
text = ""
text_comment = ""
for t in tokens:
ttype = t[0]
ttext = str(t[1])
if ttype == Token.Comment.Single:
text_comment = ttext.replace('//', '').strip()
else:
text += ttext
# Get the new comment
comment = gl.display_comment_form(text_comment)
if not comment or len(comment) == 0:
return False
comment = comment.replace("//", "").replace("\n", " ")
comment = comment.strip()
# Create the new text
full_comment = "\t// %s" % comment
text = text.rstrip()
new_text = text + full_comment
text_colored = self.color_line(new_text)
num_line = self.GetLineNo()
self.EditLine(num_line, text_colored)
self.RefreshCurrent()
# Add comment to cache
COMMENTS_CACHE.add_comment_to_cache(self.__ea, num_line, full_comment)
print("GhIDA:: [DEBUG] Added comment to #line: %d (%s)" %
(num_line, new_text))
return