Skip to content
This repository was archived by the owner on Jan 9, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions obpoplugin/idahelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ def get_block_start(ea):
return ea


def set_block_color(ea, color):
func = get_func(ea)
if not func:
return
c = FlowChart(func)
for block in c:
if block.start_ea <= ea < block.end_ea:
ni = node_info_t()
ni.bg_color = color
set_node_info(func.start_ea, block.id, ni, NIF_BG_COLOR)


def visit_instructions(bb: mblock_t):
if not bb or not bb.head:
return []
Expand Down
12 changes: 10 additions & 2 deletions obpoplugin/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# CreateTime: 2022/3/22
from ida_hexrays import mba_t
from ida_idaapi import BADADDR
from obpoplugin.idahelper import get_func_start, get_block_start
from obpoplugin.idahelper import get_func_start, get_block_start, set_block_color


# Mark Manager
Expand All @@ -15,17 +15,25 @@ def __init__(self):
def mark(self, ea):
s = self.func_marked(ea)
s.add(get_block_start(ea))
set_block_color(ea, 0x00ff00)

def unmark(self, ea):
s = self.func_marked(ea)
ea = get_block_start(ea)
if ea in s: s.remove(ea)
if ea in s:
set_block_color(ea, 0xffffff)
s.remove(ea)

def unmark_func(self, ea):
s = self.func_marked(ea)
for ea in s:
set_block_color(ea, 0xffffff)
s.clear()

def clear(self):
for s in self.marked.values():
for ea in s:
set_block_color(ea, 0xffffff)
self.marked.clear()

def func_marked(self, ea):
Expand Down