コード例 #1
0
ファイル: Program.cs プロジェクト: Zergatul/ZergatulLib
        static void CheckMailRu()
        {
            //var p1 = new Socks5(IPAddress.Parse("127.0.0.1"), 1080);
            //var p2 = new Socks5(IPAddress.Parse("46.165.223.90"), 15745);
            var p3 = new Socks5("5.35.105.211", 27888);
            //var chain = new ChainProxy(p1, p2);

            //var tcp = p3.CreateConnection(new IPAddress(new byte[] { 217, 69, 139, 202 }), 80);
            var tcp = p3.CreateConnection("steamcommunity.com", 80);
            var bytes = Encoding.ASCII.GetBytes("GET / HTTP/1.0" + Environment.NewLine + "Host: steamcommunity.com" + Environment.NewLine + Environment.NewLine);
            tcp.GetStream().Write(bytes, 0, bytes.Length);
            Console.WriteLine(new StreamReader(tcp.GetStream()).ReadToEnd());
            tcp.Close();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Zergatul/ZergatulLib
        static void tt()
        {
            var lines = plist.Split(new[] { Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 25; i < lines.Length; i++)
            {
                var line = lines[i];
                Console.WriteLine(line);
                var ss = line.Split(':');
                var ip = ss[0];
                var port = int.Parse(ss[1]);

                Exception ex = null;
                var t = new Thread(() =>
                    {
                        try
                        {
                            var p1 = new Socks5(IPAddress.Parse(ip), port);
                            //var p1 = new HttpProxy(IPAddress.Parse("175.182.229.2"), 80);
                            var tcp = p1.CreateConnection(IPAddress.Parse("1111"), 80);
                            var bytes = Encoding.ASCII.GetBytes("GET / HTTP/1.0" + Environment.NewLine + "Host: qwe" + Environment.NewLine + Environment.NewLine);
                            tcp.GetStream().Write(bytes, 0, bytes.Length);
                            var response = new StreamReader(tcp.GetStream()).ReadToEnd();
                            if (response.Contains("508 Loop Detected"))
                                Console.WriteLine("Blacklisted");
                            else
                                Console.WriteLine(response);
                            tcp.Close();
                        }
                        catch (Exception e)
                        {
                            ex = e;
                        }
                    });
                t.Start();
                if (t.Join(10000))
                {
                    if (ex != null)
                        Console.WriteLine("error");
                }
                else
                {
                    t.Abort();
                    Console.WriteLine("timeout");
                }

                Console.WriteLine();
            }

            /*var p1 = new Socks5(IPAddress.Parse("98.191.62.242"), 16902);
            //var p1 = new HttpProxy(IPAddress.Parse("175.182.229.2"), 80);
            var tcp = p1.CreateConnection(IPAddress.Parse("1111"), 80);
            var bytes = Encoding.ASCII.GetBytes("GET / HTTP/1.0" + Environment.NewLine + "Host: qwe" + Environment.NewLine + Environment.NewLine);
            tcp.GetStream().Write(bytes, 0, bytes.Length);
            Console.WriteLine(new StreamReader(tcp.GetStream()).ReadToEnd());
            tcp.Close();*/
        }