我正在开发一个应用程序,我在其中监视Internet流量(使用Fiddler Core),如果应用程序发现URL不值得信任,那么它不会让用户访问它.
现在根据Fiddler许可和协议,我将无法使用fiddler核心库.
请建议一些其他库或一些代码,可以帮助我监控互联网流量,并在URL是恶意的时阻止它.
我希望能够通过上游代理重定向来自fiddler代码的http请求,我希望能够在运行时指定这些代理.
我查看了FiddlerApplication函数,我没有看到任何可能适合的内容,以及我在文档中找不到任何匹配项(除了您可以指定启动标志以使用系统的代理作为上游代理).
在运行时指定/更改fiddler核心代理的最佳方法是什么?
我正在尝试使用FiddlerCore实现系统内SSL服务器:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace fiddlerCoreTest
{
using System.IO;
using System.Threading;
using Fiddler;
class Program
{
static Proxy oSecureEndpoint;
static string sSecureEndpointHostname = "localhost";
static int iSecureEndpointPort = 7777;
static void Main(string[] args)
{
//var tt = Fiddler.CertMaker.GetRootCertificate().GetRawCertData();
//File.WriteAllBytes("root.crt",tt);
Fiddler.FiddlerApplication.BeforeRequest += delegate(Fiddler.Session oS)
{
oS.bBufferResponse = false;
if ((oS.hostname == sSecureEndpointHostname)&&oS.port==7777)
{
oS.utilCreateResponseAndBypassServer();
oS.oResponse.headers.HTTPResponseStatus = "200 Ok";
oS.oResponse["Content-Type"] = "text/html; charset=UTF-8";
oS.oResponse["Cache-Control"] = "private, max-age=0";
oS.utilSetResponseBody("<html><body>Request for httpS://" + sSecureEndpointHostname + ":" + …Run Code Online (Sandbox Code Playgroud) 我正在使用FiddlerCore来捕获HTTP请求.只要手动安装Fiddler证书,一切都在运行,包括SSL Captures.我一直在通过Fiddler的选项菜单使用手动安装,并且工作正常.
但是,如果我使用FiddlerCore提供的CertMaker类静态方法来添加Fiddler证书,我发现我只能在当前会话中使用添加到cert根目录的证书.一旦我关闭应用程序并开始备份,就CertMaker.rootCertExists()返回false.
我使用以下代码为当前用户安装证书(此时从显式菜单选项):
public static bool InstallCertificate()
{
if (!CertMaker.rootCertExists())
{
if (!CertMaker.createRootCert())
return false;
if (!CertMaker.trustRootCert())
return false;
}
return true;
}
Run Code Online (Sandbox Code Playgroud)
证书已安装,我在当前用户的根证书库中看到它.如果我在当前运行的应用程序中捕获SSL请求,它可以正常工作.
但是,如果我关闭正在运行的exe,重新启动并调用CertMaker.certRootExists()它将返回false,如果我尝试捕获SSL请求,则SSL连接将在浏览器中失败.如果我重新创建证书,然后在应用程序保持运行时在浏览器中重新运行请求,它将再次运行.我现在最终在根存储中有两个证书.
退出并重新启动后certMaker.certRootExists()再次返回false.让它工作的唯一方法是注册证书 - 每个exe会话.
我做错了导致安装在同一个应用程序的执行之间没有问题?
我已经在这里设置了我的Fiddler代理.
码:
public class ProxyConfig
{
private readonly string _secureEndpointHostname = IPAddress.Any.ToString();
private readonly int _secureEndpointPort = 4555;
private readonly int _port = 18882;
private static readonly ICollection<Session> AllSessions = new List<Session>();
private static Fiddler.Proxy _secureEndpoint;
private static readonly LoggerCnx Logger = new LoggerCnx();
private Action<string> onRequest;
public ProxyConfig()
{
}
public ProxyConfig(Action<string> onRequest)
{
this.onRequest = onRequest;
}
public void SetupProxyListener()
{
FiddlerApplication.SetAppDisplayName("FiddlerCoreProxyApp");
// This is a workaround for known issue in .NET Core - https://github.com/dotnet/coreclr/issues/12668
CultureInfo.DefaultThreadCurrentUICulture …Run Code Online (Sandbox Code Playgroud) 我正在用c#开发一个程序,它允许我捕获WebBrowser1发出的请求.
我的问题是"请求数据"始终为空.我不明白我在哪里放"webBrowser1.Navigate"命令.
现在我的代码如下.
private void button3_Click(object sender, EventArgs e)
{
webBrowser1.ScriptErrorsSuppressed = true;
WebProxy myProxy = new WebProxy();
Uri newUri = new Uri("http://localhost:8888");
myProxy.Address = newUri;
Fiddler.FiddlerApplication.Startup(8888, false, false);
List<Fiddler.Session> oAllSessions = new List<Fiddler.Session>();
webBrowser1.Navigate("http://www.youtube.com/");
while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
{
System.Windows.Forms.Application.DoEvents();
}
Fiddler.FiddlerApplication.BeforeRequest += delegate(Fiddler.Session oS)
{
Monitor.Enter(oAllSessions);
oAllSessions.Add(oS);
Monitor.Exit(oAllSessions);
};
var message = string.Join(Environment.NewLine, oAllSessions);
MessageBox.Show(message);
Fiddler.FiddlerApplication.Shutdown();
}
Run Code Online (Sandbox Code Playgroud)
谢谢您的帮助
我正在尝试编写一个代理服务器,只是将我从远程读取的内容传递给客户端.它应该像FiddlerCore.
我按照这个研究,但与服务器IP和服务器端口混淆 http://www.partow.net/programming/tcpproxy/index.html
就像FiddlerCore一样,我设置了一个内部代理(在我的网络浏览器应用程序中),例如"127.0.0.1:13333".然后我设置代理到这个端口.因此,每当我的网络浏览器导航到某个网址时,我内部代理会捕获它所读取的内容并将我读到的任何内容返回给我的网络浏览器.
在这种情况下,似乎我只使用了一个IP地址和一个端口.但上述链接的示例需要两组.如何设置args或如何更改代码以实现我的使用?
FiddlerCore不是我的选择,但我需要的是完全相同的东西(除了它的https部分)
我从一个我想用FiddlerCore解析的网站得到一个奇怪的回应.在chrome开发人员工具中,如果我检查响应,它看起来完全正常,在fiddler中则不然.代码片段如下(以前工作正常)
String html = oSession.GetResponseBodyAsString();
Run Code Online (Sandbox Code Playgroud)
返回以下内容,这不是html,请注意这是一个示例而不是完整的大字符串.
JRHwJNeR\0???\0\0\u0001??D\0?2?\b\0?\u0016?7]<!DOCTYPE html>\n win\">
Run Code Online (Sandbox Code Playgroud)
它也充满了"\n"和这样的html
\n\n\n\n\n \n <meta name=\"treeID\" content=\"dwedxE+pgRQAWIHiFSsAAA==\">\n
Run Code Online (Sandbox Code Playgroud)
响应标头如下:
Cache-Control:no-cache, no-store
Connection:keep-alive
Content-Encoding:sdch, gzip
Content-Language:en-US
Content-Type:text/html;charset=UTF-8
Date:Fri, 28 Oct 2016 10:17:02 GMT
Expires:Thu, 01 Jan 1970 00:00:00 GMT
Pragma:no-cache
Server:Apache-Coyote/1.1
Set-Cookie:lidc="b=VB87:g=518:u=60:i=1477649823:t=1477731496:s=AQG-LTdly5mcIjAtiRHIOrKE1TiRWW-l"; Expires=Sat, 29 Oct 2016 08:58:16 GMT; domain=.thedomain.com; Path=/
Set-Cookie:_lipt=deleteMe; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/
Strict-Transport-Security:max-age=0
Transfer-Encoding:chunked
Vary:Accept-Encoding, Avail-Dictionary
X-Content-Type-Options:nosniff
X-Frame-Options:sameorigin
X-FS-UUID:882b3366afaa811400a04937a92b0000
X-Li-Fabric:prod-lva1
X-Li-Pop:prod-tln1-scalable
X-LI-UUID:iCszZq+qgRQAoEk3qSsAAA==
X-XSS-Protection:1; mode=block
Run Code Online (Sandbox Code Playgroud)
Fiddler启动代码:
Fiddler.FiddlerApplication.AfterSessionComplete += FiddlerApplication_OnAfterSessionComplete;
Fiddler.FiddlerApplication.BeforeResponse += delegate(Fiddler.Session oS) {
oS.utilDecodeResponse();
};
Fiddler.FiddlerApplication.Startup(0, FiddlerCoreStartupFlags.Default);
}
Run Code Online (Sandbox Code Playgroud)
最初我假设它是chunked/gzipped所以我添加了utilDecodeResponse(); 对onBeforeResponse没有任何影响! …
我为捕获https流量写了一个小程序.我想使用该软件捕获DECODED获取和发布数据.
如你所知,Fiddler应用程序可以像魅力那样做,现在我正在寻找一种在我的程序中这样做的方法.
例如,这是我的代码:
void FiddlerApplication_AfterSessionComplete(Fiddler.Session oSession)
{
this.Invoke(new MethodInvoker(delegate
{
oSession.bBufferResponse = true;
txtLog.Text += "full-url : \r\n" + oSession.fullUrl.ToString() + "\r\n-----------------------------------------------\r\n";
txtLog.Text += "method : \r\n" + oSession.oRequest.headers.HTTPMethod + "\r\n-----------------------------------------------\r\n";
txtLog.Text += "request headers : \r\n" + oSession.oRequest.headers + "\r\n-----------------------------------------------\r\n";
txtLog.Text += "responce headers : \r\n" + oSession.oResponse.headers + "\r\n-----------------------------------------------\r\n";
txtLog.Text += "get request body as string : \r\n" + oSession.GetRequestBodyAsString() + "\r\n-----------------------------------------------\r\n";
txtLog.Text += "request body bytes : \r\n" + oSession.requestBodyBytes + "\r\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\r\n";
txtLog.SelectionStart = txtLog.Text.Length; …Run Code Online (Sandbox Code Playgroud) 我想建立一个代理服务器来处理本地请求.
例如 - 捕获Web浏览器打印请求并将它们发送到适当的LAN打印机.
到目前为止,我的想法是在Windows服务中托管FiddlerCore引擎.
这是我的代码:
private static void Main()
{
FiddlerApplication.OnNotification += (sender, e) => Console.WriteLine("** NotifyUser: " + e.NotifyString);
FiddlerApplication.Log.OnLogString += (sender, e) => Console.WriteLine("** LogString: " + e.LogString);
FiddlerApplication.BeforeRequest += oSession => { Console.WriteLine("Before request for:\t" + oSession.fullUrl); oSession.bBufferResponse = true; ParseRequest(oSession); };
FiddlerApplication.BeforeResponse += oSession => Console.WriteLine("{0}:HTTP {1} for {2}", oSession.id, oSession.responseCode, oSession.fullUrl);
FiddlerApplication.AfterSessionComplete += oSession => Console.WriteLine("Finished session:\t" + oSession.fullUrl);
Console.CancelKeyPress += Console_CancelKeyPress;
Console.WriteLine("Starting FiddlerCore...");
CONFIG.IgnoreServerCertErrors = true;
FiddlerApplication.Startup(8877, true, true);
Console.WriteLine("Hit CTRL+C to end …Run Code Online (Sandbox Code Playgroud)