from scapy.all import *

Ether().show()

IP().display()
l3 = sr(IP(dst="www.google.com", tos=72) / ICMP(id=1, length=256, seq=57))

print("Layer 3 = ", l3)
l3.show()


def write(pkt):
    wrpcap('ICMPwriteOnly.pcap', pkt, append=True)  # appends packet to output file

for pkt in l3:
        write(pkt)  # sends the packet
        print('pkt == ', pkt)