Lab4
Lab4
Details
Aim: To define IDS detection rules for the capture of Address Resolution Protocol (ARP)
information.
Activities
1. The ARP protocol is important on networks, as it allows a node to determine the
MAC address of a destination node on the same network. For security it is
important, as it gives information on the activity on the local network. In this lab
ARP packets will be captured, and then displayed for their basic information. The
solution can be found at:
http://buchananweb.co.uk/WinPCap4.zip
16 bits 16 bits
Thus a program to capture the ARP packets is given next. Notice that the byte
array is read for the first two bytes for the hardware type, and the next two for
the protocol type [1]:
using System;
using Tamir.IPLib;
using Tamir.IPLib.Packets;
namespace NapierCapture
{
public class CapturePackets
{
public static void Main(string[] args)
{
PcapDeviceList getNetConnections = SharpPcap.GetAllDevices();
device.PcapOpen(true, 1000);
Console.WriteLine("Network connection: {0}", device.PcapDescription);
3. Modify the code so that it displays the other fields in the ARP header.
4. Modify the code so that it displays the actual ARP type, rather than the code,
Such as with:
References
[1] This code is based on the code wrapper for WinPCap developed by T.Gal
[http://www.thecodeproject.com/csharp/sharppcap.asp].
[2] http://www.networksorcery.com/enp/protocol/arp.htm
1Note: For Ethernet, the type is normal set to 1 [2]. The protocol type for IP is 0x8000 (2048),
and the table for the op-code is:
1 Request
2 Reply
3 Request Reverse
4 Rely Request