def hit_list(hits, sink_ips, sink_port):
    """
    Convert a list of hit indices or ranges into a list of [ip, port].
    :param hits: list of sink indices or
    pairs [range_start, range_end] of ranges of indices.
    :param sink_ips: list of sink ips.
    :param sink_port: port used by the sinks.
    :return list of [ip, port].
    """
    hit_ips = list()
    for i in hits:
        if isinstance(i, list):
            for j in range(i[0], i[1]+1):
                hit_ips.append([sink_ips[j], sink_port])
        else:
            hit_ips.append([sink_ips[i], sink_port])
    return hit_ips