def target_to_ipv6_short(target):
    """ Attempt to return a IPv6 short-range list from a target string. """

    splitted = target.split('-')
    if len(splitted) != 2:
        return None
    try:
        start_packed = inet_pton(socket.AF_INET6, splitted[0])
        end_value = int(splitted[1], 16)
    except (socket.error, ValueError):
        return None
    start_value = int(binascii.hexlify(start_packed[14:]), 16)
    if end_value < 0 or end_value > 0xffff or end_value < start_value:
        return None
    end_packed = start_packed[:14] + struct.pack('!H', end_value)
    return ipv6_range_to_list(start_packed, end_packed)
def target_to_ipv6_short ( target ) : splitted = target . split ( '-' ) if len ( splitted ) != 2 : return None try : start_packed = inet_pton ( socket . AF_INET6 , splitted [ 0 ] ) end_value = int ( splitted [ 1 ] , 16 ) except ( socket . error , ValueError ) : return None start_value = int ( binascii . hexlify ( start_packed [ 14 : ] ) , 16 ) if end_value < 0 or end_value > 0xffff or end_value < start_value : return None end_packed = start_packed [ : 14 ] + struct . pack ( '!H' , end_value ) return ipv6_range_to_list ( start_packed , end_packed )
Attempt to return a IPv6 short-range list from a target string.