Пример #1
0
def make_dwords():
    selected = get_selected_bytes()
    if selected:
        for ea in range(selected[1], selected[2], 4):
            if not cool_to_clobber(ea):
                print "[-] Error: Something that we shouldn't clobber at 0x%x" % ea
                break
            idaapi.doDwrd(ea, 4)
            print "[+] Processed %x" % ea
    else:
        print "[-] Error: EA is not currently a selection endpoint %x" % idc.ScreenEA(
        )
Пример #2
0
    def define(ea, count):
        # TODO: sanity checks

        idaapi.do_unknown_range(ea, count * 4, idaapi.DOUNK_DELNAMES)
        idaapi.doDwrd(ea, 4)
        idaapi.do_data_ex(ea, idaapi.getFlags(ea), count * 4, idaapi.BADADDR)
        # TODO: rewrite into idaapi calls
        idc.SetArrayFormat(ea, idc.AP_INDEX | idc.AP_IDXDEC, 1, 0)

        # Entry 0 describes the class itself => I can find out the class name.
        bcd = BaseClassDescriptor(idaapi.get_full_long(ea))
        idaapi.set_name(ea, "??_R2" + bcd.typeDescriptor.baseMangledName + "8", 0)

        i = 1
        while i < count:
            bcd = BaseClassDescriptor(idaapi.get_full_long(ea + i * 4))
            i += 1
Пример #3
0
    def define(ea, count):
        # TODO: sanity checks

        idaapi.do_unknown_range(ea, count * 4, idaapi.DOUNK_DELNAMES)
        idaapi.doDwrd(ea, 4)
        idaapi.do_data_ex(ea, idaapi.getFlags(ea), count * 4, idaapi.BADADDR)
        # TODO: rewrite into idaapi calls
        idc.SetArrayFormat(ea, idc.AP_INDEX | idc.AP_IDXDEC, 1, 0)

        # Entry 0 describes the class itself => I can find out the class name.
        bcd = BaseClassDescriptor(idaapi.get_full_long(ea))
        idaapi.set_name(ea, '??_R2' + bcd.typeDescriptor.baseMangledName + '8',
                        0)

        i = 1
        while i < count:
            bcd = BaseClassDescriptor(idaapi.get_full_long(ea + i * 4))
            i += 1
Пример #4
0
 def __init__(self, ea):
     print "Processing Class Hierarchy Descriptor at 0x%x" % ea
     do_unknown_range(ea, get_struc_size(self.tid), DOUNK_DELNAMES)
     if doStruct(ea, get_struc_size(self.tid), self.tid):
         baseClasses = get_32bit(ea + get_member_by_name(
             self.struc, "pBaseClassArray").soff) + u.x64_imagebase()
         nb_classes = get_32bit(
             ea + get_member_by_name(self.struc, "numBaseClasses").soff)
         print "Baseclasses array at 0x%x" % baseClasses
         # Skip the first base class as it is itself (could check)
         self.bases = []
         for i in range(1, nb_classes):
             baseClass = get_32bit(baseClasses + i * 4) + u.x64_imagebase()
             print "base class 0x%x" % baseClass
             doDwrd(baseClasses + i * 4, 4)
             op_offset(baseClasses + i * 4, -1, u.REF_OFF | REFINFO_RVA, -1,
                       0, 0)
             doStruct(baseClass, RTTIBaseClassDescriptor.size,
                      RTTIBaseClassDescriptor.tid)
             typeDescriptor = get_32bit(baseClass) + u.x64_imagebase()
             self.bases.append(
                 RTTITypeDescriptor(typeDescriptor).class_name)
Пример #5
0
def name_long(ea, name):
    idaapi.set_name(ea, name)
    idaapi.doDwrd(ea, 4)
    idaapi.set_offset(ea, 0, 0)
Пример #6
0
def hwreg(ea, name, comment):
    idaapi.doDwrd(ea, 4)
    idaapi.set_name(ea, name)
    idaapi.set_cmt(ea, cmt, True)  # repeatable comment
Пример #7
0
def name_cmt_long(ea, name, cmt):
    idaapi.set_name(ea, name)
    idaapi.set_cmt(ea, cmt, False)  # nonrepeatable comment
    idaapi.doDwrd(ea, 4)
    idaapi.set_offset(ea, 0, 0)