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>"); } }
public override void run() { try { string html = _httpTools.GetPage(_host + "index.php?forums/anonymous-http.4/"); string list_html = _httpTools.GetMid(html, "<ol class=\"discussionListItems\">", "</ol>"); string pattern = @"<li[^>]*>[\s\S]*?</li>"; MatchCollection mc = Regex.Matches(list_html, pattern, RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture); if (mc.Count > 1) { _urls.Add(getUrlFromLi(mc[0].Value)); _urls.Add(getUrlFromLi(mc[1].Value)); } if (this.proxys == null) { this.proxys = new List <Proxy>(); } foreach (string url in _urls) { html = _httpTools.GetPage(url); pattern = @"\w{1,3}\.\w{1,3}\.\w{1,3}\.\w{1,3}:\w{1,5}"; mc = Regex.Matches(html, pattern, RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture); foreach (Match m in mc) { string[] ip_port = m.Value.Split(':'); this.proxys.Add(new Proxy(ip_port[0], int.Parse(ip_port[1]))); } } } catch { this.onFindResult(false, this); return; } this.onFindResult(true, this); }