Configure mitmweb with chrome

user1383093 picture user1383093 · Apr 6, 2017 · Viewed 8.8k times · Source

I just want to use mitmweb to capture my chrome traffic. Can anyone share a simple example to configure chrome?

I started mitmweb :

enter image description here

But it's not capturing anything:

enter image description here

Answer

thisgeek picture thisgeek · Feb 20, 2020

First, choose and install a proxy for the client you wish to use. Chrome has many options. Many of them are available as extensions, such as the NordVPN extension that @Madhu mentioned. You may also try searching for others, e.g. via the chrome webstore.

Once you've installed the extension:

  1. Start mitmweb (which you did). For anyone else who's reading this, the output will look something like the following, assuming you're using the default configuration:
Web server listening at http://127.0.0.1:8081/
Proxy server listening at http://*:8080
  1. In your browser, visit the URL where the proxy web server is listening, probably http://127.0.0.1:8081 (which you also did).
  2. Follow the instructions for configuring the extension to use the proxy server. In my case, I configure my extension to contact the server at http://127.0.0.1:8080.
  3. Just to be sure it works the first time, make sure the extension is configured to proxy all traffic once it's switched on. Remove any filtering or switching rules that may interfere with this intended behavior.
  4. Now switch on the extension and confirm that it has activated the settings you configured. (Some extensions support creating many configurations. Make sure you've selected the right one.)
  5. Visit any website (e.g. example.com) with the browser that has the extension.

At this point you should see the traffic captured in the proxy web server. If you don't, review your configuration. Check the protocol, any filtering and switching rules, and the port (if specified).

In my experience, you can use the same Chrome browser who's traffic you want to capture as the client for the proxy web server. It may depend on which extension you choose.