Ejemplo n.º 1
0
    def show_line(self, l, i):
        show_bytes = APP.show_bytes
        res = l
        if not isinstance(l, str):
            res = "%08x " % l.ea
            if show_bytes > 0:
                bin = ""
                if not l.virtual:
                    b = self.model.AS.get_bytes(l.ea, l.size)
                    bin = str(binascii.hexlify(b[:show_bytes]), "ascii")
                    if l.size > show_bytes:
                        bin += "+"
                res += idaapi.fillstr(bin, show_bytes * 2 + 1)
            res += l.indent + l.render()

        COLOR_MAP = {
            engine.Label: C_PAIR(C_GREEN, C_BLUE),
            engine.AreaWrapper: C_PAIR(C_YELLOW, C_BLUE),
            engine.FunctionWrapper: C_PAIR(C_B_YELLOW, C_BLUE),
            engine.Xref: C_PAIR(C_MAGENTA, C_BLUE),
            engine.Unknown: C_PAIR(C_WHITE, C_BLUE),
            engine.Data: C_PAIR(C_MAGENTA, C_BLUE),
            engine.String: C_PAIR(C_B_MAGENTA, C_BLUE),
            engine.Fill: C_PAIR(C_B_BLUE, C_BLUE),
        }
        c = COLOR_MAP.get(type(l), self.def_color)
        self.attr_color(c)
        super().show_line(res, i)
        self.attr_reset()
Ejemplo n.º 2
0
    def show_line(self, l, i):
        show_bytes = APP.show_bytes
        res = l
        if not isinstance(l, str):
            res = "%08x " % l.ea
            if show_bytes > 0:
                bin = ""
                if not l.virtual:
                    b = self.model.AS.get_bytes(l.ea, l.size)
                    bin = str(binascii.hexlify(b[:show_bytes]), "ascii")
                    if l.size > show_bytes:
                        bin += "+"
                res += idaapi.fillstr(bin, show_bytes * 2 + 1)
            res += l.indent + l.render()

        COLOR_MAP = {
            engine.Label: C_PAIR(C_GREEN, C_BLUE),
            engine.AreaWrapper: C_PAIR(C_YELLOW, C_BLUE),
            engine.FunctionWrapper: C_PAIR(C_B_YELLOW, C_BLUE),
            engine.Xref: C_PAIR(C_MAGENTA, C_BLUE),
            engine.Unknown: C_PAIR(C_WHITE, C_BLUE),
            engine.Data: C_PAIR(C_MAGENTA, C_BLUE),
            engine.String: C_PAIR(C_B_MAGENTA, C_BLUE),
            engine.Fill: C_PAIR(C_B_BLUE, C_BLUE),
        }
        c = COLOR_MAP.get(type(l), self.def_color)
        self.attr_color(c)
        super().show_line(res, i)
        self.attr_reset()
Ejemplo n.º 3
0
 def render(self):
     ch = ""
     if 0x20 <= self.val <= 0x7e:
         ch = " ; '%s'" % chr(self.val)
     s = "%s0x%02x%s" % (idaapi.fillstr("unk", idaapi.DEFAULT_WIDTH), self.val, ch)
     s += self.get_comment()
     self.cache = s
     return s
Ejemplo n.º 4
0
 def render(self):
     ch = ""
     if 0x20 <= self.val <= 0x7e:
         ch = " ; '%s'" % chr(self.val)
     s = "%s0x%02x%s" % (idaapi.fillstr("unk", idaapi.DEFAULT_WIDTH), self.val, ch)
     s += self.comment
     self.cache = s
     return s
Ejemplo n.º 5
0
 def show_line(self, l):
     global show_bytes
     if not isinstance(l, str):
         res = "%08x " % l.ea
         if show_bytes > 0:
             bin = ""
             if not l.virtual:
                 b = self.model.AS.get_bytes(l.ea, l.size)
                 bin = str(binascii.hexlify(b[:show_bytes]), "ascii")
                 if l.size > show_bytes:
                     bin += "+"
             res += idaapi.fillstr(bin, show_bytes * 2 + 1)
         res += l.indent + l.render()
     super().show_line(res)
Ejemplo n.º 6
0
 def show_line(self, l):
     global show_bytes
     if not isinstance(l, str):
         res = "%08x " % l.ea
         if show_bytes > 0:
             bin = ""
             if not l.virtual:
                 b = self.model.AS.get_bytes(l.ea, l.size)
                 bin = str(binascii.hexlify(b[:show_bytes]), "ascii")
                 if l.size > show_bytes:
                     bin += "+"
             res += idaapi.fillstr(bin, show_bytes * 2 + 1)
         res += l.indent + l.render()
     super().show_line(res)
Ejemplo n.º 7
0
def data_sz2mnem(sz):
    s = {1: "db", 2: "dw", 4: "dd"}[sz]
    return idaapi.fillstr(s, idaapi.DEFAULT_WIDTH)
Ejemplo n.º 8
0
 def __init__(self, ea, sz):
     self.ea = ea
     self.size = sz
     self.cache = idaapi.fillstr(".fill", idaapi.DEFAULT_WIDTH) + str(sz)
Ejemplo n.º 9
0
 def __init__(self, ea, sz):
     self.ea = ea
     self.size = sz
     self.cache = idaapi.fillstr(".fill", idaapi.DEFAULT_WIDTH) + str(sz)
Ejemplo n.º 10
0
def data_sz2mnem(sz):
    s = {1: "db", 2: "dw", 4: "dd"}[sz]
    return idaapi.fillstr(s, idaapi.DEFAULT_WIDTH)