当前位置: 首页>>代码示例>>Python>>正文


Python idc.CIC_ITEM属性代码示例

本文整理汇总了Python中idc.CIC_ITEM属性的典型用法代码示例。如果您正苦于以下问题:Python idc.CIC_ITEM属性的具体用法?Python idc.CIC_ITEM怎么用?Python idc.CIC_ITEM使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在idc的用法示例。


在下文中一共展示了idc.CIC_ITEM属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: colorize_trace

# 需要导入模块: import idc [as 别名]
# 或者: from idc import CIC_ITEM [as 别名]
def colorize_trace(self):
        try:
            index = self.traces_tab.currentIndex()
            trace = self.core.traces[self.id_map[index]]
            if self.colorized:
                self.colorize_button.setText("Colorize trace")
                color = 0xffffff
            else:
                self.colorize_button.setText("Uncolorize trace")
                self.colorize_button.setFlat(True)
                color = 0x98FF98
            for inst in trace.instrs.values():
                if idc.isCode(idc.GetFlags(inst.address)):
                    idc.SetColor(inst.address, idc.CIC_ITEM, color)
            if not self.colorized:
                self.colorize_button.setFlat(False)
                self.colorized = True
            else:
                self.colorized = False

        except KeyError:
            print "No trace found" 
开发者ID:RobinDavid,项目名称:idasec,代码行数:24,代码来源:TraceWidget.py

示例2: heatmap_trace

# 需要导入模块: import idc [as 别名]
# 或者: from idc import CIC_ITEM [as 别名]
def heatmap_trace(self):
        try:
            index = self.traces_tab.currentIndex()
            trace = self.core.traces[self.id_map[index]]
            if self.heatmaped:
                self.heatmap_button.setText("Heatmap")
                color = lambda x: 0xffffff
            else:
                self.heatmap_button.setText("Heatmap undo")
                self.heatmap_button.setFlat(True)
                hit_map = trace.address_hit_count
                color_map = self.compute_step_map(set(hit_map.values()))
                print color_map
                color = lambda x: color_map[hit_map[x]]
            for inst in trace.instrs.values():
                if idc.isCode(idc.GetFlags(inst.address)):
                    c = color(inst.address)
                    idc.SetColor(inst.address, idc.CIC_ITEM, c)
            if not self.heatmaped:
                self.heatmap_button.setFlat(False)
                self.heatmaped = True
            else:
                self.heatmaped = False
        except KeyError:
            print "No trace found" 
开发者ID:RobinDavid,项目名称:idasec,代码行数:27,代码来源:TraceWidget.py

示例3: color_head

# 需要导入模块: import idc [as 别名]
# 或者: from idc import CIC_ITEM [as 别名]
def color_head(ea):
    flags = ida_bytes.get_flags(ea)
    if not ida_bytes.is_code(flags):
        return

    mnem = ida_ua.print_insn_mnem(ea)
    if mnem == 'call':
        logger.debug('call: 0x%x', ea)
        idc.set_color(ea, idc.CIC_ITEM, CALL_COLOR)
    elif mnem == 'xor':
        if idc.get_operand_value(ea, 0) != idc.get_operand_value(ea, 1):
            logger.debug('non-zero xor: 0x%x', ea)
            idc.set_color(ea, idc.CIC_ITEM, ENCRYPT_COLOR)
    elif mnem in ('sdit', 'sgdt', 'sldt', 'smsw', 'str', 'in', 'cpuid'):
        logger.debug('anti-vm: 0x%x', ea)
        idc.set_color(ea, idc.CIC_ITEM, ANTIANALYSIS_COLOR)
    elif mnem == 'in':
        if idc.get_operand_value(ea, 0) in ("3", "2D"):
            logger.debug('anti-debug: 0x%x', ea)
            idc.set_color(ea, idc.CIC_ITEM, ANTIANALYSIS_COLOR)
    elif mnem in ('rdtsc', 'icebp'):
        logger.debug('anti-debug: 0x%x', ea)
        idc.set_color(ea, idc.CIC_ITEM, ANTIANALYSIS_COLOR) 
开发者ID:williballenthin,项目名称:idawilli,代码行数:25,代码来源:color.py

示例4: signature_selected

# 需要导入模块: import idc [as 别名]
# 或者: from idc import CIC_ITEM [as 别名]
def signature_selected(self, item):
        self.subsignatures_list.clear()

        for ea, color in self.previous_colors:
            idc.SetColor(ea, idc.CIC_ITEM, color)
        self.previous_colors = []
        self.match_label.setText("")

        if item.parsed_signature is None:
            pass
        else:
            if isinstance(item.parsed_signature, LdbSignature):
                for i, subsig in enumerate(item.parsed_signature.subsignatures):
                    item2 = QtWidgets.QListWidgetItem("% 2d   %s:%s" % (i, str(subsig.offset), subsig.clamav_signature))
                    item2.subsignature_name = "$subsig_%02x" % i
                    self.subsignatures_list.addItem(item2)
            elif isinstance(item.parsed_signature, NdbSignature):
                self.match_label.setText("No match")

            print_console("Signature selected: %s" % item.text())
            self.yara_scanner.scan(item.yara_rule) 
开发者ID:Cisco-Talos,项目名称:CASC,代码行数:23,代码来源:casc_plugin.py

示例5: subsignature_selected

# 需要导入模块: import idc [as 别名]
# 或者: from idc import CIC_ITEM [as 别名]
def subsignature_selected(self, item):
        try:
            match = self.matches[item.subsignature_name]
            self.match_label.setText("Match:   EA: 0x%08x  Length: % 4d     Bytes: %s" % \
                    (match["ea"], len(match["data"]), " ".join("%02x" % ord(x) for x in match["data"])))
            idc.Jump(match["ea"])
            for ea, color in self.previous_colors:
                idc.SetColor(ea, idc.CIC_ITEM, color)
            self.previous_colors = []
            for ea in idautils.Heads(match["ea"], match["ea"] + len(match["data"])):
                self.previous_colors.append((ea, idc.GetColor(ea, idc.CIC_ITEM)))
                idc.SetColor(ea, idc.CIC_ITEM, SIGALYZER_COLOR_HIGHLIGHTED)
        except KeyError:
            self.match_label.setText("No match")
            for ea, color in self.previous_colors:
                idc.SetColor(ea, idc.CIC_ITEM, color)
            self.previous_colors = []
        except IndexError:
            log.exception("While selecting subsignature") 
开发者ID:Cisco-Talos,项目名称:CASC,代码行数:21,代码来源:casc_plugin.py

示例6: highlight_dead_code

# 需要导入模块: import idc [as 别名]
# 或者: from idc import CIC_ITEM [as 别名]
def highlight_dead_code(self, enabled):
        curr_fun = idaapi.get_func(idc.here()).startEA
        cfg = self.functions_cfg[curr_fun]
        # for cfg in self.functions_cfg.values():
        for bb in cfg.values():
            color = {Status.DEAD: 0x5754ff, Status.ALIVE: 0x98FF98, Status.UNKNOWN: 0xaa0071}[bb.status]
            color = 0xFFFFFF if enabled else color
            for i in bb:
                idc.SetColor(i, idc.CIC_ITEM, color)
        self.actions[HIGHLIGHT_DEAD_CODE] = (self.highlight_dead_code, not enabled)
        self.result_widget.action_selector_changed(HIGHLIGHT_DEAD_CODE) 
开发者ID:RobinDavid,项目名称:idasec,代码行数:13,代码来源:static_opaque_analysis.py

示例7: highlight_spurious

# 需要导入模块: import idc [as 别名]
# 或者: from idc import CIC_ITEM [as 别名]
def highlight_spurious(self, enabled):
        print "Highlight spurious clicked !"
        curr_fun = idaapi.get_func(idc.here()).startEA
        cfg = self.functions_cfg[curr_fun]
        color = 0xFFFFFF if enabled else 0x507cff
        for bb in [x for x in cfg.values() if x.is_alive()]:  # Iterate only alive basic blocks
            for i, st in bb.instrs_status.items():
                if st == Status.DEAD:  # Instructions dead in alive basic blocks are spurious
                    idc.SetColor(i, idc.CIC_ITEM, color)
        self.actions[HIGHLIGHT_SPURIOUS_CALCULUS] = (self.highlight_spurious, not enabled)
        self.result_widget.action_selector_changed(HIGHLIGHT_SPURIOUS_CALCULUS) 
开发者ID:RobinDavid,项目名称:idasec,代码行数:13,代码来源:static_opaque_analysis.py

示例8: highlight_dead

# 需要导入模块: import idc [as 别名]
# 或者: from idc import CIC_ITEM [as 别名]
def highlight_dead(self, enabled):
        opaque_map = {k: self.make_po_pair(k, v.alive_branch) for k, v in self.results.items()
                      if v.status == po_analysis_results.OPAQUE}
        for addr, (good, dead) in opaque_map.items():
            if not enabled:  # Mark instructions
                print "propagate dead branch:%x" % addr
                self.propagate_dead_code(dead, opaque_map)
            else:
                for addr2 in self.marked_addresses.keys():
                    idc.SetColor(addr2, idc.CIC_ITEM, 0xffffff)
                self.marked_addresses.clear()
        self.actions[self.HIGHLIGHT_DEAD_BRANCHES] = (self.highlight_dead, not enabled)
        self.result_widget.action_selector_changed(self.HIGHLIGHT_DEAD_BRANCHES) 
开发者ID:RobinDavid,项目名称:idasec,代码行数:15,代码来源:opaque_analysis.py

示例9: highlight_dependency

# 需要导入模块: import idc [as 别名]
# 或者: from idc import CIC_ITEM [as 别名]
def highlight_dependency(self, enabled):
        if self.results.has_formula():
            color = 0xffffff if enabled else 0x98FF98
            for addr in self.formula.get_addresses():
                idc.SetColor(addr, idc.CIC_ITEM, color)
        else:
            print "woot ?"
        self.actions[self.HIGHLIGHT_CODE] = (self.highlight_dependency, not enabled)
        self.result_widget.action_selector_changed(self.HIGHLIGHT_CODE) 
开发者ID:RobinDavid,项目名称:idasec,代码行数:11,代码来源:generic_analysis.py

示例10: colorNode

# 需要导入模块: import idc [as 别名]
# 或者: from idc import CIC_ITEM [as 别名]
def colorNode(self, node, color):
        try:
            set_color(node, CIC_ITEM, ColorCore.rgb_to_bgr(color))
        except:
            SetColor(node, CIC_ITEM, ColorCore.rgb_to_bgr(color)) 
开发者ID:AirbusCyber,项目名称:grap,代码行数:7,代码来源:PatternGenerator.py

示例11: add_match

# 需要导入模块: import idc [as 别名]
# 或者: from idc import CIC_ITEM [as 别名]
def add_match(self, match):
        """Associate a color to a match id.

        Arguments:
            match (Match): Match to add.
        """
        match_id = match.get_match_id()
        pattern_id = match.get_pattern_id()
        insts = match.get_match()

        for getid, node_list in insts.items():
            if not node_list.empty():

                # Add all match instructions.
                for node in node_list:

                    if match_id not in self._matches_colors:
                        self._matches_colors[match_id] = {}
                    
                    try:
                        c = get_color(node.info.address, CIC_ITEM)
                    except:
                        c = GetColor(node.info.address, CIC_ITEM)
                    self._matches_colors[match_id][node.info.address] = {
                        "new": self._patterns_colors[pattern_id],
                        "old": c
                    } 
开发者ID:AirbusCyber,项目名称:grap,代码行数:29,代码来源:CryptoIdentifier.py

示例12: highlight_matches

# 需要导入模块: import idc [as 别名]
# 或者: from idc import CIC_ITEM [as 别名]
def highlight_matches(self):
        """Highlight all the matches."""
        
        for insts in self._matches_colors.values():
            for ea, color in insts.items():
                try:
                    set_color(ea, CIC_ITEM, ColorCore.rgb_to_bgr(color['new']))
                except:
                    SetColor(ea, CIC_ITEM, ColorCore.rgb_to_bgr(color['new'])) 
开发者ID:AirbusCyber,项目名称:grap,代码行数:11,代码来源:CryptoIdentifier.py

示例13: color

# 需要导入模块: import idc [as 别名]
# 或者: from idc import CIC_ITEM [as 别名]
def color(self):
        """Line color in IDA View"""
        color = idc.get_color(self.ea, idc.CIC_ITEM)
        if color == 0xFFFFFFFF:
            return None

        return color 
开发者ID:tmr232,项目名称:Sark,代码行数:9,代码来源:line.py

示例14: clean_lines

# 需要导入模块: import idc [as 别名]
# 或者: from idc import CIC_ITEM [as 别名]
def clean_lines():
    "Remove previous comments"
    global comments
    for offset in comments:
        idc.set_color(offset, idc.CIC_ITEM, 0xffffff)
        idc.set_cmt(offset, "", 0)
    comments = {} 
开发者ID:cea-sec,项目名称:miasm,代码行数:9,代码来源:depgraph.py

示例15: treat_element

# 需要导入模块: import idc [as 别名]
# 或者: from idc import CIC_ITEM [as 别名]
def treat_element():
    "Display an element"
    global graphs, comments, sol_nb, settings, addr, ir_arch, ircfg

    try:
        graph = next(graphs)
    except StopIteration:
        comments = {}
        print("Done: %d solutions" % (sol_nb))
        return

    sol_nb += 1
    print("Get graph number %02d" % sol_nb)
    filename = os.path.join(tempfile.gettempdir(), "solution_0x%08x_%02d.dot" % (addr, sol_nb))
    print("Dump the graph to %s" % filename)
    open(filename, "w").write(graph.graph.dot())

    for node in graph.relevant_nodes:
        try:
            offset = ircfg.blocks[node.loc_key][node.line_nb].instr.offset
        except IndexError:
            print("Unable to highlight %s" % node)
            continue
        comments[offset] = comments.get(offset, []) + [node.element]
        idc.set_color(offset, idc.CIC_ITEM, settings.color)

    if graph.has_loop:
        print('Graph has dependency loop: symbolic execution is inexact')
    else:
        print("Possible value: %s" % next(iter(viewvalues(graph.emul(ir_arch)))))

    for offset, elements in viewitems(comments):
        idc.set_cmt(offset, ", ".join(map(str, elements)), 0) 
开发者ID:cea-sec,项目名称:miasm,代码行数:35,代码来源:depgraph.py


注:本文中的idc.CIC_ITEM属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。