Chatterbox Part 13 — Capturing model with Fiddler

This is the thirteenth part of the Chatterbox series. For your convenience you can find other parts in the table of contents in Part 1 – Origins

Some networks communicate over websockets which are much harder to scrape with a Chrome extension. I tried some code on the internet (mostly based on replacing the websocket constructor and injecting proxy implementation) but none of them worked reliably over a longer time. However, we can easily get that with Fiddler. You can take the code from GitHub

This scrapes websockets traffic and parses it. We can extend the code to do whatever we want with the received response. The only thing we need to do is to configure the Chrome browser to go through the Fiddler and then do the magic.

Now, let’s say that you extracted the message from a websocket. What do you do with it? You can for instance call your service:

But what if your Fiddler needs to go through a proxy (for instance to connect over a tunnel to some intranet)? You can add this logic to send your request outside of the proxy:

What if you need to reply some traffic from the browser? For instance, to refresh the state? You can do this:

And then you can grab the response:

And what if you need to call some external application? Fiddler is based on .NET so you just call System.Diagnostics.Process.Start("cmd.exe", "/c echo 123") and you’re good.