Thema: [C#] Proxyfinder
-
26.01.2012, 13:51 #1
- Registriert seit
- 19.12.2011
- Beiträge
- 356
Thanked 164 Times in 101 Posts[C#] Proxyfinder
Aus meinem Client, tested and working....
Benutzt die Klasse Server aus der KNDeKaDeNz.Net.
Solltet ihr diese nicht mit einbinden wollen, hier nochmal der Source für die einzelne Klasse.
PHP-Code:public class Server
{
public Server(string host, int port)
{
this.host = host;
this.port = port;
}
override public string ToString()
{
return host + ":" + port;
}
public string getHost() { return host; }
public int getPort(){ return port;}
private string host;
private int port = 0;
}
PHP-Code:using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading;
using System.Net.Sockets;
namespace KNDeKaDeNz.Net
{
public class ProxyFinder
{
public delegate void checkedProxyEvent(int state);
public event checkedProxyEvent checkedProxy;
public void checkProxy(Server p, int timeout)
{
string host = p.getHost();
int port = p.getPort();
new Thread(delegate()
{
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.BeginConnect(host, port, null, null).AsyncWaitHandle.WaitOne(timeout);
if (socket.Connected)
{
this.checkedProxy(1);
}
else
{
this.checkedProxy(0);
}
socket.Close();
}).Start();
}
private void newSocks(object e, DownloadStringCompletedEventArgs a)
{
String src = a.Result;
Dictionary<string, int> D = new Dictionary<string, int>();
Match C = Regex.Match(src, "(.*)BigBlind(.*)");
String t = C.Groups[0].Value;
String[] acts = t.Split(';');
foreach (String act in acts)
{
if (act.Trim() == "") break;
string act2 = act.Trim();
string key = act2.Split('=')[0].Trim();
string value = act2.Split('=')[1].Trim();
if (!value.Contains('^'))
{
int v = int.Parse(value);
D.Add(key, v);
}
else
{
string v1 = value.Split('^')[0]; int v1i = 0;
string v2 = value.Split('^')[1]; int v2i = 0;
try
{
v1i = int.Parse(v1);
}
catch
{
v1i = D[v1];
}
try
{
v2i = int.Parse(v2);
}
catch
{
v2i = D[v2];
}
int v = v1i ^ v2i;
if (v == 0)
{
bool lol2 = true;
}
D.Add(key, v);
}
}
src = src.Replace("\n", "");
string host = Regex.Match(src, "\\<td class=\\\"t_ip\\\">(.*?)\\<\\/td\\>").Groups[1].Value;
string str3 = Regex.Match(src, "\\<td class=\\\"t_port\\\">(.*?)\\<\\/td\\>").Groups[1].Value;
Match str2 = Regex.Match(str3, "\\((.*?)\\^(.*?)\\^(.*?)\\)");
String mv1 = str2.Groups[1].Value;
String mv2 = str2.Groups[2].Value;
String mv3 = str2.Groups[3].Value;
int mvi1 = 0, mvi2 = 0, mvi3 = 0;
try
{
mvi1 = int.Parse(mv1);
}
catch
{
mvi1 = D[mv1];
}
try
{
mvi2 = int.Parse(mv2);
}
catch
{
mvi2 = D[mv2];
}
try
{
mvi3 = int.Parse(mv3);
}
catch
{
mvi3 = D[mv3];
}
int port = mvi1 ^ mvi2 ^ mvi3;
gotProxy(new Server(host, port));
}
public delegate void gotProxyEvent(Server proxy);
public event gotProxyEvent gotProxy;
public void getProxy()
{
WebClient client = new WebClient();
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(this.newSocks);
client.DownloadStringAsync(new Uri("http://sockslist.net/"));
}
}
}
Geändert von DeKaDeNz (26.01.2012 um 13:53 Uhr)
Diese Seite nutzt Cookies, um das Nutzererlebnis zu verbessern. Klicken Sie hier, um das Cookie-Tracking zu deaktivieren.