# Build IPv6 ICMP ECHO packet with Ethernet headers Simple C code that builds a valid (ish) ethernet icmpv6 echo packet. * https://en.wikipedia.org/wiki/Ethernet_frame * https://en.wikipedia.org/wiki/IPv6_packet * https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol_for_IPv6 * https://www.pdbuchan.com/rawsock/icmp6_cooked.c * https://stackoverflow.com/a/14937171 * https://github.com/secdev/scapy/blob/a1f999fb1721a64415af75d575cabde19625a6f5/scapy/utils.py#L493-L501 * https://github.com/secdev/scapy/blob/a1f999fb1721a64415af75d575cabde19625a6f5/scapy/layers/inet6.py#L608-L624 ## Scapy code samples Writen in `scapy` shell ```python # import hex as packet e = Ether(bytes.fromhex('fc de ad be ef 05 fc de ad be ef 56 86 dd 60 00 00 00 00 08 3a 02 fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 01 fe 80 00 00 00 00 00 00 50 5d 18 fb 5e 52 ec c0 81 00 4e cd 00 00 00 00 ef be ad de')) e.show() # Write packet as pcap to open in Wireshark wrpcap("test.pcap", e) # Calculate icmpv6 checksum i = e[IPv6][ICMPv6EchoReply] i.cksum = 0 r = raw(i) print(hex(in6_chksum(socket.IPPROTO_ICMPV6, e[IPv6], r))) ```