Beispiel #1
0
        private void readIPs(string proxylist)
        {
            string tmp = proxylist;

            if (this.proxys == null)
            {
                this.proxys = new List <Proxy>();
            }
            int tr_index = tmp.IndexOf("</tr>");

            while (tr_index != -1)
            {
                string one_proxy_info = _httpTools.GetMid(tmp, "<tr><td>", "</td></tr>");
                string ip             = _httpTools.GetIpFromStr(one_proxy_info);
                string port_js        = _httpTools.GetMid(one_proxy_info, "<script type=\"text/javascript\">", "</script>");
                port_js = port_js.Replace("document.write", "");
                string port_str = _httpTools.RunJs(_js + "\n" + port_js);
                port_str = port_str.Replace(":", "");
                int   port = int.Parse(port_str);
                Proxy p    = new Proxy(ip, port);
                this.proxys.Add(p);
                tmp      = tmp.Remove(0, tmp.IndexOf("</tr>") + "</tr>".Length);
                tr_index = tmp.IndexOf("</tr>");
            }
        }
        private void readIPs(string proxylist)
        {
            string tmp = proxylist;

            if (this.proxys == null)
            {
                this.proxys = new List <Proxy>();
            }
            int tr_index = tmp.IndexOf("</tr>");

            while (tr_index != -1)
            {
                string one_proxy_info = _httpTools.GetMid(tmp, "<tr><td>", "</td></tr>");
                string ip             = _httpTools.GetIpFromStr(one_proxy_info);
                string port_js        = _httpTools.GetMid(one_proxy_info, "<SCRIPT type=text/javascript>", "</SCRIPT>");
                port_js = port_js.Replace("document.write", "");
                string port_str = _httpTools.RunJs(_js + "\n" + port_js);
                port_str = port_str.Replace(":", "");
                int   port = int.Parse(port_str);
                Proxy p    = new Proxy(ip, port);
                if (one_proxy_info.IndexOf("HTTP", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    p.type = eProxyType.HTTP;
                }
                else if (one_proxy_info.IndexOf("SOCKS4", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    p.type = eProxyType.SOCKS4;
                }
                else if (one_proxy_info.IndexOf("SOCKS5", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    p.type = eProxyType.SOCKS5;
                }
                this.proxys.Add(p);
                tmp      = tmp.Remove(0, tmp.IndexOf("</tr>") + "</tr>".Length);
                tr_index = tmp.IndexOf("</tr>");
            }
        }