-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHighlight_Instructions.py
More file actions
61 lines (48 loc) · 1.92 KB
/
Highlight_Instructions.py
File metadata and controls
61 lines (48 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from idc import *
from idautils import *
import idaapi
class aan_highlight_instructions_t(idaapi.plugin_t):
flags = idaapi.PLUGIN_KEEP
comment = ''
help = ''
wanted_name = 'aan_Highlight_Instructions'
wanted_hotkey = 'ctrl-shift-h'
def init(self):
return idaapi.PLUGIN_KEEP
def run(self):
aan_Highlight_Instructions()
def term(self):
pass
def PLUGIN_ENTRY():
return aan_highlight_instructions_t()
def aan_Highlight_Instructions():
CALL_COLOR = 0x000000 # black
STR_OPERATION_COLOR = 0x005500 # forest green
BUFFER_COLOR = 0x5a4b27
ENCRYPTION_COLOR = 0x62086c
ZERO_OUT_COLOR = 0x656565
DEFAULT_COLOR = 0xffffffff
ea = ScreenEA()
segStartEA = SegStart(ea)
segEndEA = SegEnd(ea)
for currentEA in Heads(segStartEA, segEndEA):
currentMnem = GetMnem(currentEA)
currentColor = GetColor(currentEA, CIC_ITEM)
if currentMnem == 'call':
changeColor = CALL_COLOR if currentColor == DEFAULT_COLOR else DEFAULT_COLOR
SetColor(currentEA, CIC_ITEM, changeColor)
if currentMnem == 'scas' or currentMnem == 'movs' or currentMnem == 'stos':
changeColor = STR_OPERATION_COLOR if currentColor == DEFAULT_COLOR else DEFAULT_COLOR
SetColor(currentEA, CIC_ITEM, changeColor)
if currentMnem == 'xor' and (GetOpnd(currentEA,0) == GetOpnd(currentEA, 1)):
changeColor = ZERO_OUT_COLOR if currentColor == DEFAULT_COLOR else DEFAULT_COLOR
SetColor(currentEA, CIC_ITEM, changeColor)
if currentMnem == 'lea':
changeColor = BUFFER_COLOR if currentColor == DEFAULT_COLOR else DEFAULT_COLOR
SetColor(currentEA, CIC_ITEM, changeColor)
if currentMnem == 'xor' and (GetOpnd(currentEA,0) != GetOpnd(currentEA, 1)):
changeColor = ENCRYPTION_COLOR if currentColor == DEFAULT_COLOR else DEFAULT_COLOR
SetColor(currentEA, CIC_ITEM, changeColor)
if __name__ == '__main__':
pass
#aan_Highlight_Instructions()