![]() |
|
[C#] Parallel Proxy Tester - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] Parallel Proxy Tester (/showthread.php?tid=5773377) |
Parallel Proxy Tester - passwords - Dec 23, 2017 Still needs work! Sources So I just threw together a quick proxy tester that works but it could work better. The proxy tester only supports HTTP/HTTPS proxies as far as I know, if otherwise please correct me. In a hurry so I wanted to make this post quick, might come back and update this Source: https://github.com/Wolfijiyn/SimpleParalellProxyTester/blob/master/ParallelProxyTester/Program.cs Source Clean (Not tested): https://github.com/Wolfijiyn/SimpleParalellProxyTester/blob/master/CleanCode.cs RE: Parallel Proxy Tester - Ninja - Dec 23, 2017 Why would you run the loop in it's own thread? It's a Console Application, it won't freeze up. Also, you are not validating inputs, so if someone enters incorrect proxy strings the program crashes. And the Export function is useless, as you can do File.WriteAllText or File.WriteAllLines. And instead of Convert.ToInt32 I suggest you use "int.TryParse(string input, out int output)" as you get a bool returned whether or not the parsing was successful (this adds to the input validation bit). And instead of the if-statement on line 77 you could do this: "return Content.Contains("CmyIP.org");" to shorten it. These are all minor things, and I don't mean to degrade you or your work as I love the release and effort you put up. This is meant for you to learn from. PS: If you want, you can use sockets instead of the HttpClient to connect to the proxy server and check if it uses the protocol you want. This method is a bit harder but faster. EDIT: This was for the first link. In the clean version you already fixed some of the issues I addressed, but not all of them. RE: Parallel Proxy Tester - passwords - Dec 23, 2017 (Dec 23, 2017 10:56 AM)Ninja Wrote: Why would you run the loop in it's own thread? It's a Console Application, it won't freeze up. Also, you are not validating inputs, so if someone enters incorrect proxy strings the program crashes. And the Export function is useless, as you can do File.WriteAllText or File.WriteAllLines. And instead of Convert.ToInt32 I suggest you use "int.TryParse(string input, out int output)" as you get a bool returned whether or not the parsing was successful (this adds to the input validation bit). And instead of the if-statement on line 77 you could do this: "return Content.Contains("CmyIP.org");" to shorten it. I appriciate the feedback, and I mainly created this as a quick and dirty solution to test my proxies becase I was looking for HTTP/HTTPS proxies specifically. I'll rewrite the code later and I'll take your comment into consideration! 🤝 RE: Parallel Proxy Tester - itcorp - Dec 23, 2017 (Dec 23, 2017 10:56 AM)Ninja Wrote: Why would you run the loop in it's own thread? It's a Console Application, it won't freeze up. Also, you are not validating inputs, so if someone enters incorrect proxy strings the program crashes. And the Export function is useless, as you can do File.WriteAllText or File.WriteAllLines. And instead of Convert.ToInt32 I suggest you use "int.TryParse(string input, out int output)" as you get a bool returned whether or not the parsing was successful (this adds to the input validation bit). And instead of the if-statement on line 77 you could do this: "return Content.Contains("CmyIP.org");" to shorten it. I absolutely agree with you about usage of sockets is faster... Here's a quick socket variant for test Code public class ProxyListCode List<ProxyList> proxyList = new List<ProxyList>()Code Parallel.ForEach(proxyList, pl => Code private string ProxyTest(string ip,int port)RE: Parallel Proxy Tester - Ninja - Dec 23, 2017 (Dec 23, 2017 07:47 PM)itcorp Wrote: - LARGE QUOTE - Great suggestion, though I suggest input validation and more specific error handling so you know the exact reason a proxy doesn't work (incorrect proxy string, IP failed to parse, port out of range, host is down, host timed out, etc.). Also, instead of returning a string, you could return a bool and/or throw exceptions. To OP:This method is not guaranteed, as that the host is up does not necessarily mean that it acts as a proxy; though the bad part is that you have to send an HTTP request to see if it indeed does act as a proxy. For socks proxies it is different and easier as there is a handshake and authentication protocol. Here is my attempt (Click to View) This of course only checks if the host is up. If you want, you can keep open the socket instance and then try a few different protocols on that to identify which type of proxy it is (if it is one in the first place). RE: Parallel Proxy Tester - itcorp - Dec 24, 2017 (Dec 23, 2017 08:25 PM)Ninja Wrote: Great suggestion, though I suggest input validation and more specific error handling so you know the exact reason a proxy doesn't work (incorrect proxy string, IP failed to parse, port out of range, host is down, host timed out, etc.). Also, instead of returning a string, you could return a bool and/or throw exceptions. Again agree with you.I gave this as an example your way is much more elegant and better from my i did not go deeper with this.Thanks for your reply RE: Parallel Proxy Tester - ForceJew - Dec 25, 2017 Great job! havent seen projects from you in some times, wasnt active;) |