public void callEvents(proxyEventReturn e) { foreach (ProxyConEvent s in events) { s.runMethod(e); } }
private string proxConnectStr(string proxIP, int port) { proxyEventReturn e = new proxyEventReturn(); if (proxUseList) { e.totalProxies = proxyList.Count(); } else { e.totalProxies = 1; } try { e.proxyIP = proxIP; e.proxyPort = port; WebClient cli = new WebClient(); WebProxy myproxy = new WebProxy(proxIP, port); cli.Proxy = myproxy; string returnStr = cli.DownloadString(url); e.response = returnStr; successfulProx.Add(prox); return(returnStr); } catch (Exception er) { failedProx.Add(prox); e.error = er.Message; return(er.Message); } }
/* * * Proxy connect, return string for completion * */ private string proxConnectStr(string prox) { proxyEventReturn e = new proxyEventReturn(); if (proxUseList) { e.totalProxies = proxyList.Count(); } else { e.totalProxies = 1; } try { string[] sp = prox.Split(':'); string proxIP = sp[0]; int proxPort = Convert.ToInt32(sp[1]); e.proxyIP = proxIP; e.proxyPort = proxPort; WebClient cli = new WebClient(); WebProxy myproxy = new WebProxy(proxIP, proxPort); cli.Proxy = myproxy; string returnStr = cli.DownloadString(url); e.response = returnStr; callEvents(e); successfulProx.Add(prox); return(returnStr); } catch (Exception er) { e.error = er.Message; failedProx.Add(prox); return(er.Message); } }
public static void eventYeh(proxyEventReturn e) { string resp = "Failed"; if (e.response != "") { resp = "Voted"; } Console.Clear(); print("======================"); print("CompProxy IP: " + e.proxyIP); print("CompProxy Port: " + e.proxyPort); print("CompResp: " + resp); print("Active: " + e.activeProxies); print("Complete: " + e.proxiesUsed); print(""); print("Total: " + e.totalProxies); print("Left: " + (e.totalProxies - e.proxiesUsed)); print("======================"); }
/* * * Proxy connect, return bool for completion * */ private bool proxConnect(string prox, int tCount = -1) { proxyEventReturn e = new proxyEventReturn(); if (proxUseList) { e.totalProxies = proxyList.Count(); } else { e.totalProxies = 1; } Thread tr = null; if (tCount != -1) { tr = activeThreads[tCount - 1]; } try { string[] sp = prox.Split(':'); string proxIP = sp[0]; int proxPort = Convert.ToInt32(sp[1]); e.proxyIP = proxIP; e.proxyPort = proxPort; //Console.WriteLine(proxIP); WebClient cli = new WebClient(); WebProxy myproxy = new WebProxy(proxIP, proxPort); cli.Proxy = myproxy; if (postHeaders != "") { cli.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; string HtmlResult = cli.UploadString(url, postHeaders); } string returnStr = cli.DownloadString(url); e.response = returnStr; successfulProx.Add(prox); //curProx += 1; if (tCount != -1) { e.activeProxies = activeThreads.Count(); e.proxiesUsed = threadsRan.Count(); activeThreads.Remove(tr); callEvents(e); tr.Abort(); } callEvents(e); return(true); } catch (Exception er) { //curProx += 1; activeThreads.Remove(tr); e.error = er.Message; failedProx.Add(prox); return(false); } }
public void runMethod(proxyEventReturn e) { d(e); }