13 Years of Service
24%

Features:
- lists proxy from .txt files.
- check if proxy is working (socket)
- export alive proxy
- uses background worker
Additional imports:
Code:
>using System.Net;
using System.Net.Sockets;
Code:
>OpenFileDialog opfd = new OpenFileDialog();
private string[] ipport;
Code:
>aliveIPLV.Items.Clear();
btnCheck.Enabled = false;
bworker.RunWorkerAsync();
Code:
>opfd.FileName= "";
opfd.Title = "Select proxy list file.";
opfd.Filter = "txt files|*.txt";
string pattern = @"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{1,5}$";
Regex rgx = new Regex(pattern);
if (opfd.ShowDialog() == DialogResult.OK)
{
txtlocation.Text = opfd.FileName;
availableIPLV.Items.Clear();
btnExport.Enabled = false;
ipport = File.ReadAllLines(opfd.FileName);
for(int i = 0; i {
MatchCollection matches = rgx.Matches(ipport[i]);
if (matches.Count > 0)
{
foreach (Match mat in matches)
{
//MessageBox.Show(mat.Value);
string[] ipadd = mat.Value.Split(':');
availableIPLV.Items.Add(ipadd[0]);
availableIPLV.Items[i].SubItems.Add(ipadd[1]);
}
}
else {
MessageBox.Show("No IPs Found in the file!\r\n Format should bein: IP:Port", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
btnCheck.Enabled = true;
}
Code:
>string[] ips = ipport;
Socket connsock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
connsock.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 200);
for (int j = 0; j {
try
{
System.Threading.Thread.Sleep(500);
string splitip = ips[j].ToString();
string[] hostip = splitip.Split(':');
double progress;
progress = (j + 1) * 100 / ips.Length;
IPAddress hip = IPAddress.Parse(hostip[0]);
int hport = int.Parse(hostip[1]);
statusInfo.Text = "Trying: " + hostip[0] + ":" + hostip[1];
//check through socket connection
IPEndPoint ipep = new IPEndPoint(hip, hport);
connsock.Connect(ipep);
if (connsock.Connected)
{
bworker.ReportProgress(Convert.ToInt32(Math.Round(progress)), j);
continue;
}
else
{
bworker.ReportProgress(Convert.ToInt32(Math.Round(progress)), "");
}
connsock.Close();
}
catch(SocketException x)
{
//problem
}
}
Code:
>statusPbar.Value = e.ProgressPercentage;
string aliveproxycounter = e.UserState.ToString();
if (aliveproxycounter != null) {
string[] aliveproxy = ipport[int.Parse(aliveproxycounter)].Split(':');
aliveIPLV.Items.Add(aliveproxy[0]).SubItems.Add(aliveproxy[1]);
}
Code:
>if (aliveIPLV.Items.Count > 0)
{
btnExport.Enabled = true;
}
btnCheck.Enabled = true;
statusPbar.Value = 0;
statusInfo.Text = "Ready";
Code:
>int numofcount = aliveIPLV.Items.Count;
string[] aproxy = new string[numofcount];
for (int i = 0; i {
aproxy[i] = aliveIPLV.Items[i].Text.ToString() + ":"+ aliveIPLV.Items[i].SubItems[1].Text.ToString();
}
SaveFileDialog sfile = new SaveFileDialog();
sfile.Filter = "txt files|*.txt";
sfile.Title = "Save fresh proxy";
// sfile.ShowDialog();
if (sfile.ShowDialog() == DialogResult.OK)
{
File.WriteAllLines(sfile.FileName, aproxy);
}