private void button1_Click(object sender, EventArgs e) { using ( PacketCommunicator communicator = frmCapture.myDevice.Open(100, PacketDeviceOpenAttributes.Promiscuous, 1000)) { var ethernetFrame = Utils.BuildEthernetFrame(new MacAddress(FrmSmurf.MacAddressFormat(data.MacAddress)), new MacAddress("FF:FF:FF:FF:FF:FF")); Packet packet; var Ips = GenerateIps(); foreach (string ip in Ips) { var arpFrame = Utils.BuildArpFrame(data.MacAddress, data.IpAddressInformation.Address, IPAddress.Parse(ip)); packet = Utils.BuildArpPacket(ethernetFrame, arpFrame); communicator.SendPacket(packet); } } }
public arpCache() { InitializeComponent(); network = IPNetwork.Parse(data.IpAddressInformation.Address, data.IpAddressInformation.IPv4Mask); arpTable = Utils.GetArpTable(); //My data txtDnsSuffix.Text = data.DnsSuffix; txtIp.Text = data.IpAddressInformation.Address.ToString(); txtMacAddress.Text = FrmSmurf.MacAddressFormat(data.MacAddress); txtClass.Text = classLevel; txtMask.Text = data.IpAddressInformation.IPv4Mask.ToString(); //octets Data var addressBytes = network.Network.GetAddressBytes(); txtFirstOctet.Text = addressBytes[0].ToString(); txtSecondOctet.Text = addressBytes[1].ToString(); txtThirdOctet.Text = addressBytes[2].ToString(); txtFourthOctet.Text = addressBytes[3].ToString(); DisableTxtWithNetwork(); }
private void updateUI(IPAddress client) { txtOutput.AppendText($"{client} ---> {FrmSmurf.MacAddressFormat(arpTable[client])}\n"); }