Ejemplo n.º 1
0
def save_long_str_to_idb(array_name, value):
    """ Overwrites old array completely in process """
    id = idc.get_array_id(array_name)
    if id != -1:
        idc.delete_array(id)
    id = idc.create_array(array_name)
    r = []
    for idx in xrange(len(value) / 1024 + 1):
        s = value[idx * 1024:(idx + 1) * 1024]
        r.append(s)
        idc.set_array_string(id, idx, s)
Ejemplo n.º 2
0
    def switch_inverted(self, address):
        if self.__id == -1:
            self.__id = idc.create_array(self.__name)
            idc.set_array_string(self.__id, 0, str(address))
        else:
            inverted = self.get_inverted()
            try:
                inverted.remove(address)
                if not inverted:
                    idc.delete_array(self.__id)

            except KeyError:
                inverted.add(address)

            idc.set_array_string(self.__id, 0, " ".join(map(str, inverted)))
Ejemplo n.º 3
0
def invert(func_ea, if_ea):
    # Store information about swaps (affected through actions)
    iv_rva = if_ea - idaapi.get_imagebase()
    func_rva = func_ea - idaapi.get_imagebase()
    internal_name = _ARRAY_STORAGE_PREFIX + hex(int(func_rva))
    internal_id = idc.get_array_id(internal_name)
    if internal_id == -1:
        internal_id = idc.create_array(internal_name)
        idc.set_array_string(internal_id, 0, str(iv_rva))
    else:
        inverted = get_inverted(func_ea)
        try:
            inverted.remove(iv_rva)
            if not inverted:
                idc.delete_array(internal_id)

        except KeyError:
            inverted.add(iv_rva)

        idc.set_array_string(internal_id, 0, " ".join(map(str, inverted)))