When I was starting to learn scapy library, and tried to make some ARP packets, it was a little bit hard to find what I needed in the documentation and Google. These are just a few notes that may help.
¿What are the parameters in an ARP packet?
We can see them creating a void ARP packet and then calling show() method. This is the output of Python CLI:
>>> x = ARP()
>>> x.show()
###[ ARP ]###
hwtype = 0x1
ptype = 0x800
hwlen = 6
plen = 4
op = who-has
hwsrc = 78:ac:c0:43:11:f8
psrc = 192.168.1.2
hwdst = 00:00:00:00:00:00
pdst = 0.0.0.0
The ARP operation is encoded in the op attribute, which may be set to "who-has" (ARP REQUEST) or "is-at" (ARP REPLY).
Example:
pkt = Ether() / ARP(psrc="10.0.0.2",pdst="10.0.0.1",op="is-at",hwsrc="00:1B:C9:21:08:7E")
