Fiddler没有通过代理捕获连接
本文关键字:连接 代理 Fiddler | 更新日期: 2023-09-27 18:11:24
我有一个c#程序,通过一些外部代理进行一些连接。
Fiddler无法捕获这些不使用Fiddler作为代理的请求
是否有任何方法使这些连接先通过fiddler在任何c#方式或fiddler设置方式?
你可以使用FiddlerCore链接代理…
Proxy p = new Proxy(new List<string>() { "122.129.107.3:8080" }); //real proxies...
WebClient wc = new WebClient();
wc.Proxy = new WebProxy("127.0.0.1", 8888); //local proxy(fiddler core)
wc.Headers["User-Agent"] = "SO/1.0";
var html = wc.DownloadString("http://google.com");
public class Proxy
{
List<string> _Proxies = null;
public Proxy(List<string> proxies)
{
_Proxies = proxies;
Fiddler.FiddlerApplication.BeforeRequest += FiddlerApplication_BeforeRequest;
Fiddler.FiddlerApplication.Startup(8888, false, true);
}
static long _Sequence = 0;
void FiddlerApplication_BeforeRequest(Fiddler.Session oSession)
{
var sequence = Interlocked.Increment(ref _Sequence);
string proxy = _Proxies[(int)(sequence % _Proxies.Count)];
oSession["x-OverrideGateway"] = proxy;
Console.WriteLine(String.Format("Proxy[{0}]> {1}", proxy, oSession.host));
}
}
只是传递一个代理列表给这个类。它将为每个请求使用不同的一个。您的客户端将只使用这个Proxy类