本文整理汇总了Python中idc.SetColor方法的典型用法代码示例。如果您正苦于以下问题:Python idc.SetColor方法的具体用法?Python idc.SetColor怎么用?Python idc.SetColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idc
的用法示例。
在下文中一共展示了idc.SetColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: colorize_trace
# 需要导入模块: import idc [as 别名]
# 或者: from idc import SetColor [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"
示例2: heatmap_trace
# 需要导入模块: import idc [as 别名]
# 或者: from idc import SetColor [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"
示例3: Sync
# 需要导入模块: import idc [as 别名]
# 或者: from idc import SetColor [as 别名]
def Sync(self, pc, bps):
""" Sync(pc, bps) => None
Synchronize debug info with gef. This is an internal function. It is
not recommended using it from the command line.
"""
global _breakpoints, _current_instruction, _current_instruction_color
if _current_instruction > 0:
idc.SetColor(_current_instruction, CIC_ITEM, _current_instruction_color)
_current_instruction = long(pc)
_current_instruction_color = GetColor(_current_instruction, CIC_ITEM)
idc.SetColor(_current_instruction, CIC_ITEM, 0x00ff00)
for bp in bps:
if bp not in _breakpoints:
idc.AddBpt(bp)
_breakpoints.add(bp)
_new = [ idc.GetBptEA(n) for n in range(idc.GetBptQty()) ]
return _new
示例4: signature_selected
# 需要导入模块: import idc [as 别名]
# 或者: from idc import SetColor [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)
示例5: subsignature_selected
# 需要导入模块: import idc [as 别名]
# 或者: from idc import SetColor [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")
示例6: highlight_dead_code
# 需要导入模块: import idc [as 别名]
# 或者: from idc import SetColor [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)
示例7: highlight_spurious
# 需要导入模块: import idc [as 别名]
# 或者: from idc import SetColor [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)
示例8: highlight_dead
# 需要导入模块: import idc [as 别名]
# 或者: from idc import SetColor [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)
示例9: highlight_dependency
# 需要导入模块: import idc [as 别名]
# 或者: from idc import SetColor [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)
示例10: markupEa
# 需要导入模块: import idc [as 别名]
# 或者: from idc import SetColor [as 别名]
def markupEa(self, markup_ea, colorFunc=True):
if markup_ea and markup_ea != idc.BADADDR:
func_color = self._func_color_picker.currentColor()
ea_color = self._color_picker.currentColor()
log.debug("Coloring instructions for 0x{:08x}".format(markup_ea))
idc.SetColor(markup_ea, idc.CIC_FUNC,
int("0x{:02x}{:02x}{:02x}".format(*func_color.getRgb()[:3][::-1]), 16))
if colorFunc:
idc.SetColor(markup_ea, idc.CIC_ITEM,
int("0x{:02x}{:02x}{:02x}".format(*ea_color.getRgb()[:3][::-1]), 16))
示例11: removeMarkup
# 需要导入模块: import idc [as 别名]
# 或者: from idc import SetColor [as 别名]
def removeMarkup(self, ea, force=False):
if ea in self._marked_up or force:
log.debug("Removing color")
idc.SetColor(ea, idc.CIC_FUNC, 0xffffff)
idc.SetColor(ea, idc.CIC_ITEM, 0xffffff)
idc.MakeComm(ea, "")
log.debug("Removing posterior lines")
i = 0
while idc.LineB(ea, i):
idc.DelExtLnB(ea, i)
i += 1
示例12: set_color
# 需要导入模块: import idc [as 别名]
# 或者: from idc import SetColor [as 别名]
def set_color(addr, color):
idc.SetColor(addr, idc.CIC_ITEM, color)
示例13: SetColor
# 需要导入模块: import idc [as 别名]
# 或者: from idc import SetColor [as 别名]
def SetColor(self, address, color="0x005500"):
""" SetColor(int addr [, int color]) => None
Set the location pointed by `address` in the IDB colored with `color`.
Example: ida SetColor 0x40000
"""
addr = long(address, 16) if ishex(address) else long(address)
color = long(color, 16) if ishex(color) else long(color)
return idc.SetColor(addr, CIC_ITEM, color)
示例14: yara_match
# 需要导入模块: import idc [as 别名]
# 或者: from idc import SetColor [as 别名]
def yara_match(self, strings):
if isinstance(self.signatures_list.currentItem().parsed_signature, LdbSignature):
self.matches = dict((x["identifier"], x) for x in strings)
else:
self.matches = {}
self.match_label.setText("Match: EA: 0x%08x Length: % 4d Bytes: %s" % \
(strings[0]["ea"], len(strings[0]["data"]), " ".join("%02x" % ord(x) for x in strings[0]["data"])))
idc.Jump(strings[0]["ea"])
for ea in idautils.Heads(strings[0]["ea"], strings[0]["ea"] + len(strings[0]["data"])):
self.previous_colors.append((ea, idc.GetColor(ea, idc.CIC_ITEM)))
idc.SetColor(ea, idc.CIC_ITEM, SIGALYZER_COLOR_HIGHLIGHTED)
示例15: saving
# 需要导入模块: import idc [as 别名]
# 或者: from idc import SetColor [as 别名]
def saving(self):
for ea, color in self.previous_colors:
idc.SetColor(ea, idc.CIC_ITEM, color)