How to Record HTTP/HTTPS Traffic with Mitmproxy? | Loadium

How to record HTTP/HTTPS traffic with mitmproxy?

Mobile performance engineering projects require record and playing while dealing with mobile apps. JMeter has a very good Proxy Recorder…

How to record HTTP/HTTPS traffic with mitmproxy?

Mobile performance engineering projects require record and playing while dealing with mobile apps. JMeter has a very good Proxy Recorder but there are other tools to help you overcome the challenges. One of these tools is; mitmproxy. You can browse its web site by https://mitmproxy.org/

Mitmproxy is a lightweight, fully capable proxy recorder. It has an interactive console and many functionalities to explore. We’ll do some basic stuff as an entry level tutorial.

How to Install Mitmproxy

You can use the below command to install it.

brew install mitmproxy

It will download and install all the dependency in a minute.

How to Start Mitmproxy

Open a terminal screen. Enter “mitmproxy” and you’ll be welcomed by this screen.

As you can see, mitmproxy started listening to your request by its default port which is 8080. You can change the port with the below command.

mitmproxy --listen--port #PORTNO

Configure your Mobile Device for Proxy

  • Your mobile device needs to be on the same wireless network.
  • Install mitmproxy’s certificate into your mobile device to capture HTTPS traffic.
  • Set your mobile devices proxy settings as described in this blog post.
  • Do any operation you want and get the recording
  • You can navigate the request by using up and down arrow buttons on your keyboard.
  • You can enter one request’s detail by clicking on it.

Some Useful Commands

Writing the output to a file

In the recording screen, press “e”, then select “raw”. It will ask you the location. Enter the location and anything related to that request (custom-headers, body data, path, etc..) will be saved into a file.

Return to the Main Console

Press “:” and write “console.view.pop”. You’ll be directed back to the main console.

Clear Recording

Just click “z” to clear mitmproxy console.

Replay the Request

Just click “r” to replay the request from the proxy.

There are many more commands that you can explore. Just type mitmproxy — commands before starting and browse all the commands.

Happy recording and load testing!

Latest articles

All Articles →

How To Upload File in Jmeter

How To Upload File in Jmeter

What Is Visual Testing

What Is Visual Testing

Craft Powerful Performance Tests with Ease Loadium Script Builder

Craft Powerful Performance Tests with Ease Loadium Script Builder