Esempio n. 1
0
        public void ScanFromAsync(IpAddress ipAddress, int port = 80)
        {
            while (!stop)
            {
                Console.WriteLine("start");

                var holdingpoint = ipAddress.Increment(255 * 5); //ESTABLECE UNA IP DE ESPERA PARA MEJORAR EL RENDIMIENTO

                while (ipAddress.CompareTo(holdingpoint) == -1)
                {
                    try
                    {
                        _ = ScanAsync(ipAddress, port);

                        ipAddress = ipAddress.Increment(1);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Source + " " + ex.Message);
                    }
                }

                //ESTE CICLO PERMITE LA RECEPCION DE RESPUESTAS SIN GENERAR CONFLICTOS EN LA RED
                //TENIENDO LA MEJOR PERFORMANCE EN LAS PRUEBAS REALIZADAS
                int count = 0;

                while (count < 50)
                {
                    Thread.Sleep(250);
                    count++;
                }
            }

            Console.WriteLine("DONE!");
        }
Esempio n. 2
0
        public void ScanAllRangeWithClassifierAsync(IpAddress ipAddressBegin, IpAddress ipAddressEnd, int port = 80, bool followRedirects = false)
        {
            IpAddress ip = ipAddressBegin;

            while (ip.CompareTo(ipAddressEnd) == -1)
            {
                var holdingpoint = ip.Increment(255 * 5);                                    //HOLDINGPOINT ES UN PUNTO DE ESPERA PARA RECIBIR PAQUETES ENVIADOS

                while (ip.CompareTo(holdingpoint) == -1 && ip.CompareTo(ipAddressEnd) == -1) //Agregar comparacion con ipend, porque sigue un poco de largo.
                {
                    try
                    {
                        Console.WriteLine(ip);
                        ScanWithClassifierAsync(ip, port, followRedirects);
                        //ScanAsync(ip, port, followRedirects);

                        ip = ip.Increment(1);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Source + " " + ex.Message);
                    }
                }

                //ESTE CICLO PERMITE LA RECEPCION DE RESPUESTAS SIN GENERAR CONFLICTOS EN LA RED
                //TENIENDO LA MEJOR PERFORMANCE EN LAS PRUEBAS REALIZADAS
                int count = 0;

                while (count < 50)
                {
                    Thread.Sleep(250);
                    count++;
                }
            }

            Console.WriteLine("DONE!");
        }