Create your own ARP packet using SharpPcap

SharpPcap library project

EthernetPacket MakeArpRequest(
	PhysicalAddress InterfaceMacAddress, 
	IPAddress destinationIP, IPAddress senderIP)
{
	try
	{
		PhysicalAddress fakeBroadcastMAC = PhysicalAddress.Parse("FFFFFFFFFFFF");
 
		EthernetPacket ethernetpacket = new EthernetPacket(InterfaceMacAddress, 
		fakeBroadcastMAC, EthernetPacketType.Arp);
 
		ARPPacket arppacket = new ARPPacket(ARPOperation.Request, fakeBroadcastMAC, 
		destinationIP, InterfaceMacAddress, senderIP);
 
		ethernetpacket.PayloadPacket = arppacket;
 
		return ethernetpacket;
	}
	catch
	{
		return null;
	}
}
Categories: C# Tags: , , ,
%d bloggers like this: