예제 #1
0
파일: ICMP6.py 프로젝트: lxbeyond/impacket
    def __build_node_information_message(class_object, type, code, payload = None):
        #Build ICMP6 header
        icmp_packet = ICMP6()
        icmp_packet.set_type(type)
        icmp_packet.set_code(code)
        
        #Pack ICMP payload
        qtype = 0
        flags = 0
        nonce = [0x00] * 8
        
        icmp_bytes = struct.pack('>H', qtype)
        icmp_bytes += struct.pack('>H', flags)
        icmp_bytes += array.array('B', nonce).tostring()
        
        if payload is not None:
            icmp_bytes += array.array('B', payload).tostring()
        
        icmp_payload = Data()
        icmp_payload.set_data(icmp_bytes)
        
        #Link payload to header
        icmp_packet.contains(icmp_payload)

        return icmp_packet
예제 #2
0
    def __build_node_information_message(class_object, type, code, payload = None):
        #Build ICMP6 header
        icmp_packet = ICMP6()
        icmp_packet.set_type(type)
        icmp_packet.set_code(code)
        
        #Pack ICMP payload
        qtype = 0
        flags = 0
        nonce = [0x00] * 8
        
        icmp_bytes = struct.pack('>H', qtype)
        icmp_bytes += struct.pack('>H', flags)
        icmp_bytes += array.array('B', nonce).tostring()
        
        if payload is not None:
            icmp_bytes += array.array('B', payload).tostring()
        
        icmp_payload = Data()
        icmp_payload.set_data(icmp_bytes)
        
        #Link payload to header
        icmp_packet.contains(icmp_payload)

        return icmp_packet
예제 #3
0
파일: ICMP6.py 프로젝트: lxbeyond/impacket
 def __build_error_message(class_object, type, code, data, originating_packet_data):
     #Build ICMP6 header
     icmp_packet = ICMP6()
     icmp_packet.set_type(type)
     icmp_packet.set_code(code)
     
     #Pack ICMP payload
     icmp_bytes = array.array('B', data).tostring()
     if (originating_packet_data is not None):
         icmp_bytes += array.array('B', originating_packet_data).tostring()
     icmp_payload = Data()
     icmp_payload.set_data(icmp_bytes)
     
     #Link payload to header
     icmp_packet.contains(icmp_payload)
     
     return icmp_packet
예제 #4
0
 def __build_error_message(class_object, type, code, data, originating_packet_data):
     #Build ICMP6 header
     icmp_packet = ICMP6()
     icmp_packet.set_type(type)
     icmp_packet.set_code(code)
     
     #Pack ICMP payload
     icmp_bytes = array.array('B', data).tostring()
     if (originating_packet_data is not None):
         icmp_bytes += array.array('B', originating_packet_data).tostring()
     icmp_payload = Data()
     icmp_payload.set_data(icmp_bytes)
     
     #Link payload to header
     icmp_packet.contains(icmp_payload)
     
     return icmp_packet
예제 #5
0
파일: ICMP6.py 프로젝트: lxbeyond/impacket
 def __build_echo_message(class_object, type, id, sequence_number, arbitrary_data):
     #Build ICMP6 header
     icmp_packet = ICMP6()
     icmp_packet.set_type(type)
     icmp_packet.set_code(0)
     
     #Pack ICMP payload
     icmp_bytes = struct.pack('>H', id)
     icmp_bytes += struct.pack('>H', sequence_number)
     if (arbitrary_data is not None):
         icmp_bytes += array.array('B', arbitrary_data).tostring()
     icmp_payload = Data()
     icmp_payload.set_data(icmp_bytes)
     
     #Link payload to header
     icmp_packet.contains(icmp_payload)
     
     return icmp_packet
예제 #6
0
 def __build_echo_message(class_object, type, id, sequence_number, arbitrary_data):
     #Build ICMP6 header
     icmp_packet = ICMP6()
     icmp_packet.set_type(type)
     icmp_packet.set_code(0)
     
     #Pack ICMP payload
     icmp_bytes = struct.pack('>H', id)
     icmp_bytes += struct.pack('>H', sequence_number)
     if (arbitrary_data is not None):
         icmp_bytes += array.array('B', arbitrary_data).tostring()
     icmp_payload = Data()
     icmp_payload.set_data(icmp_bytes)
     
     #Link payload to header
     icmp_packet.contains(icmp_payload)
     
     return icmp_packet
예제 #7
0
파일: ICMP6.py 프로젝트: lxbeyond/impacket
 def __build_neighbor_message(class_object, msg_type, target_address):
     #Build ICMP6 header
     icmp_packet = ICMP6()
     icmp_packet.set_type(msg_type)
     icmp_packet.set_code(0)
     
     # Flags + Reserved
     icmp_bytes = array.array('B', [0x00] * 4).tostring()       
     
     # Target Address: The IP address of the target of the solicitation.
     # It MUST NOT be a multicast address.
     icmp_bytes += array.array('B', IP6_Address(target_address).as_bytes()).tostring()
     
     icmp_payload = Data()
     icmp_payload.set_data(icmp_bytes)
     
     #Link payload to header
     icmp_packet.contains(icmp_payload)
     
     return icmp_packet
예제 #8
0
 def __build_neighbor_message(class_object, msg_type, target_address):
     #Build ICMP6 header
     icmp_packet = ICMP6()
     icmp_packet.set_type(msg_type)
     icmp_packet.set_code(0)
     
     # Flags + Reserved
     icmp_bytes = array.array('B', [0x00] * 4).tostring()       
     
     # Target Address: The IP address of the target of the solicitation.
     # It MUST NOT be a multicast address.
     icmp_bytes += array.array('B', IP6_Address(target_address).as_bytes()).tostring()
     
     icmp_payload = Data()
     icmp_payload.set_data(icmp_bytes)
     
     #Link payload to header
     icmp_packet.contains(icmp_payload)
     
     return icmp_packet