Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

[C#] Basic Proxy Checker source

I just wrote a Proxy Checker to improve my knowledge on multi-threading and invoking while on another thread, and this is what I made of it ^^

[Image: fqogg.png]

When you check the proxies

[Image: iojbV.png]

End result

[Image: 9EQpZ.png]

Pretty basic stuff, you can enter the timeout in the textbox and it will rule out all proxies that have a timeout for longer than that time (= not working or way to slow)

Up to you to advance it, such as resizing the app with anchors (easy ^^), copy to clipboard, scrollbars and stuff.

The source in plain text:

PHP Code

<?php 
int Working 
= 0;
  
int Broken = 0;
  
int Timeout = 10000;

  private 
void btnCheck_Click(object sender, EventArgs e)
  {
    
Working = 0;
    
Broken = 0;
    
Timeout = Convert.ToInt32(txtTimeout.Text);
    
string[] Lines = txtInputProxies.Lines;
    
prgProgress.Maximum = Lines.Length;

    for (
int i = 0; i < Lines.Length; i++)
    {
    new 
Thread(
    
delegate(object o)
    {
    try
    {
    
string[] Proxy = ((string)o).Split(':');
    
WebRequest req = WebRequest.Create("http://google.nl");
    
req.Proxy = new WebProxy(Proxy[0], Convert.ToInt32(Proxy[1]));
    
req.Timeout = Timeout;
    
req.GetResponse();
    
UpdateStatus(true, string.Join(":", Proxy));
    }
    catch
    {
    
UpdateStatus(false, "");
    }
    }
    ).
Start(Lines[i]);
    }
  }

  private 
void UpdateStatus(bool goodProxy, string Proxy)
  {
    
Invoke(new MethodInvoker(
    
delegate()
    {
    
prgProgress.Value++;
    if (
goodProxy)
    {
    
txtWorkingProxies.Text += Proxy + Environment.NewLine;
    
lblWorking.Text = "Working: " + (++Working).ToString();
    }
    else
    {
    
lblBroken.Text = "Broken: " + (++Broken).ToString();
    }
    
lblTotal.Text = "Total: " + (Broken + Working).ToString();
    }));
  } 

And if you'd like the project here it is: http://leetcoders.org/forum/showthread.php?tid=128 (Scroll to the bottom)

Have fun with it :)

CaptainBri
This looks really nice :D thank you, im downloading now. :)
Thanks you very much! i will probably use this in the future!
Seems like it will crash with more than 1,000 proxies lol.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by fillobottoDec 22, 2021 03:10 AM 32 3,163 Dec 22, 2021 03:10 AM
Last Post: SIM-1729678
[.NET] by nathan72389Dec 4, 2021 10:27 AM 7 941 Dec 4, 2021 10:27 AM
Last Post: zatt
[C#] by AlernNov 27, 2020 08:48 AM 5 328 Nov 27, 2020 08:48 AM
Last Post: FrenchWolf