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


Python idaapi.tag_remove方法代碼示例

本文整理匯總了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 
開發者ID:Cisco-Talos,項目名稱:GhIDA,代碼行數:26,代碼來源:ghida.py

示例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 
開發者ID:L4ys,項目名稱:LazyIDA,代碼行數:27,代碼來源:LazyIDA.py

示例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)) 
開發者ID:arizvisa,項目名稱:ida-minsc,代碼行數:18,代碼來源:function.py

示例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() 
開發者ID:danigargu,項目名稱:deREferencing,代碼行數:18,代碼來源:registers.py

示例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) 
開發者ID:arizvisa,項目名稱:ida-minsc,代碼行數:13,代碼來源:instruction.py

示例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 
開發者ID:danigargu,項目名稱:deREferencing,代碼行數:7,代碼來源:custom.py

示例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 
開發者ID:danigargu,項目名稱:deREferencing,代碼行數:13,代碼來源:registers.py

示例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 
開發者ID:Cisco-Talos,項目名稱:GhIDA,代碼行數:49,代碼來源:ghida.py


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