Files
idapython-src/examples/core/install_user_defined_prefix.py
T
2020-05-27 14:34:02 +02:00

42 lines
938 B
Python

from __future__ import print_function
import ida_lines
import ida_idaapi
PREFIX = ida_lines.SCOLOR_INV + ' ' + ida_lines.SCOLOR_INV
class my_user_prefix_t(ida_lines.user_defined_prefix_t):
def get_user_defined_prefix(self, ea, insn, lnnum, indent, line):
if (ea % 2 == 0) and indent == -1:
return PREFIX
else:
return ""
class prefix_plugin_t(ida_idaapi.plugin_t):
flags = 0
comment = "This is a user defined prefix sample plugin"
help = "This is help"
wanted_name = "user defined prefix"
wanted_hotkey = ""
def __init__(self):
self.prefix = None
def init(self):
self.prefix = my_user_prefix_t(8)
print("prefix installed")
return ida_idaapi.PLUGIN_KEEP
def run(self, arg):
pass
def term(self):
self.prefix = None
print("prefix uninstalled!")
def PLUGIN_ENTRY():
return prefix_plugin_t()