例子,python发送伪造arp请求数据。
#!/usr/bin/env python
import socket
s = socket.socket(socket.AF_PACKET, socket.SOCK_RAW)
s.bind(("lo", 0))
src_addr = "x50x3dxe5x0ex35x3f"
dst_addr = "xffxffxffxffxffxff"
ethertype = "x08x06"
s.send(dst_addr+src_addr+ethertype+"x00x01"+"x08x00"+"x06"+"x04"+"x00x01"+src_addr+"x7fx00x00x01"+"x00x00x00x00x00x00"+"x7fx00x00x01")