How to set FiddlerCore up to monitor all system traffic?

322 Views Asked by At

We are evaluating FiddlerCore for a use-case. Basically, for now we just want to catch all of the endpoints/urls being requested on a system. This works fine in Fiddler, no issues. But we only want to catch them while a certain vendor software is open. So we want to write a plugin to that software that will run when it launches, and then exit when it exits. Hence, using FiddlerCore (hopefully).

As proof-of-concept, I just made a simple app, one form with a textbox, that it should just append each url into the textbox. Simple as simple can be. However, it's not doing anything. I run the app, then refresh a page in my browser, and ... nothing.

Here is the entire (non-generated) code of my program...

using Fiddler;
using System;
using System.Windows.Forms;

namespace ScratchCSharp {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();

            FiddlerApplication.AfterSessionComplete += FiddlerApplication_AfterSessionComplete;
            FiddlerApplication.Startup(8888, FiddlerCoreStartupFlags.Default);
        }

        private void FiddlerApplication_AfterSessionComplete(Session s) {
            textBox1.Invoke((Action)delegate () {
                AddText(s.fullUrl);
            });
        }

        public void AddText(string text) {
            textBox1.Text += $"{text}\n";
        }
    }
}

After a little more poking around, I see that FiddlerApplication.IsSystemProxy is returning false. Seems to have to do with that the Startup flag to set as system proxy is no longer honored, and it tells you now to use the Telerik.NetworkConnections.NetworkConnectionManager to set it as the system proxy. But I can't find anywhere that actually says how to do that. The closest thing I could find is this thread which seems to be their official answer to this question. However, it only goes into a lot of talk about WHY they deprecated the flag, and what their thinking was in how they designed its replacement, but not actually into HOW TO USE the replacement. The Demo app also does NOT use these libraries (probably why it doesn't catch anything either).

The biggest problem though, is that the NetworkConnectionsManager class has no public constructor, so you can't create an instance. It is not inheritable, so you can't make a subclass instance. All of the methods on it are instance methods, not static/shared. And there seems to be no method in the libraries which will create an instance of NetworkConnectitonsManager for you.

So while the class is clearly designed to be used as an instance (hence the methods not being static/shared, there doesn't actually seem to be any way to create an instance.

Any help on how to set this thing up to catch all the outgoing URLs on the system?

1

There are 1 best solutions below

0
Borislav Ivanov On

You can use the following code for starting Fiddler Core and registering it as a system proxy:

FiddlerCoreStartupSettings startupSettings =
    new FiddlerCoreStartupSettingsBuilder()
        .ListenOnPort(fiddlerCoreListenPort)
        .RegisterAsSystemProxy()
        .ChainToUpstreamGateway()
        .DecryptSSL()
        .OptimizeThreadPool()
        .Build();

FiddlerApplication.Startup(startupSettings);

Some of the methods are obsolete for now, but I would recommend to stick with them until the NetworkConnectionManager API is improved and finalized.

Also, there is a sample application (that FiddlerCore installer installs on the Desktop), which is useful for a starting point with the development.