Python Scapy script to craft an ARP request packet

This tutorial demonstrates how an ARP request packet can be sent at Layer 2 using Scapy and Python. The program takes the destination address as the required IP address (192.168.1.2), and uses the sendp functionality in scapy. In this program an ARP packet is crafted where the ether header is given as broadcast for ARP request packets. The packet is sent by appending ethernet headers. The Packet is then sent using the sendp command.Python file is used for the purpose.

——————————————————————————————————————-
Ebook – Building Network troubleshooting tools with Python and Scapy

Buy from Amazon

——————————————————————————————————————-

from scapy.all import*
ether=ETHER()
arp=ARP()
ether.dst=’ff:ff:ff:ff:ff:ff’
dst=raw_input(‘n enter the destination ip address=’)
arp.op=1
arp.pdst=dst
sendp(ether/arp)

Learn to make custom tools and scripts with Python and ScapyClick Here