Esempio n. 1
0
        private void Flood()
        {
            int count = 100;

            if (rdTornado.Checked)
            {
                count = 100;
            }
            if (rdSlow.Checked)
            {
                count = 10;
            }
            if (rdFast.Checked)
            {
                count = 50;
            }

            for (int i = 1; i < count; i++)
            {
                CdpPacket cdp = new CdpPacket();
                cdp.AddTLV(CdpPacket.CdpTypes.CDP_TYPE_DEVID, txtDeviceID.Text + (lastIndexOfDevice++));
                cdp.AddTLV(CdpPacket.CdpTypes.CDP_TYPE_SOFTWARE_VERSION, txtSoftVersion.Text);
                cdp.AddTLV(CdpPacket.CdpTypes.CDP_TYPE_PLATFORM, txtPlatform.Text);
                cdp.AddTLV(CdpPacket.CdpTypes.CDP_TYPE_CAPABILITY, "0x" + txtCapabilities.Text);


                if (chkMacof.Checked)
                {
                    List <ushort> SourceMac = new List <ushort>();
                    for (int j = 1; j <= 6; j++)
                    {
                        SourceMac.Add(Convert.ToUInt16(GetRandomNumber(1, 255)));
                    }
                    cdp.SourceMac = SourceMac;
                }


                device.SendPacket(cdp.PacketBytes);
            }
            CDCount += 100;
        }
Esempio n. 2
0
        public void SendIPPacket(int mode)
        {
            if (device == null)
            {
                Log("Please Select an interface");
                return;
            }

            int readTimeoutMilliseconds = 1000;

            device.Open(DeviceMode.Normal, readTimeoutMilliseconds);


            if (!chkFlood.Checked)
            {
                for (int i = 0; i < Convert.ToInt16(txtCount.Text); i++)
                {
                    CdpPacket cdp = new CdpPacket();
                    cdp.AddTLV(CdpPacket.CdpTypes.CDP_TYPE_DEVID, txtDeviceID.Text + i);
                    cdp.AddTLV(CdpPacket.CdpTypes.CDP_TYPE_SOFTWARE_VERSION, txtSoftVersion.Text);
                    cdp.AddTLV(CdpPacket.CdpTypes.CDP_TYPE_PLATFORM, txtPlatform.Text);

                    device.SendPacket(cdp.PacketBytes);
                }
                device.Close();
            }
            else
            {
                lastIndexOfDevice    = new Random().Next(100, 1000);
                Continue             = true;
                tFlood.Enabled       = true;
                btnStopFlood.Visible = true;
                imgLoading.Visible   = true;

                var x = 1;
            }
        }