Edit on GitHub

Modify Requests

In the previous step we resumed intercepted requests without changes. The full power of interceptions comes to play when we modify an intercepted request before forwarding it to its destination. You can continue with the window and the already configured interception rule from the previous step.

Video Content

  1. Welcome to the mitmproxy tutorial. In this lesson we cover the modification of intercepted requests.
00:00
  1. We configure and use the same interception rule as in the last tutorial.
00:16
  1. Press i to prepopulate mitmproxy’s command prompt, enter the flow filter ~u /Dunedin & ~q, and press ENTER.
00:22
  1. Let’s generate a request using curl in a separate terminal.
00:40
  1. We now want to modify the intercepted request.
01:08
  1. Put the focus (>>) on the intercepted flow. This is already the case in our example.
01:12
  1. Press ENTER to open the details view for the intercepted flow.
01:19
  1. Press e to edit the intercepted flow.
01:25
  1. mitmproxy asks which part to modify.
01:29
  1. Select path by using your arrow keys and press ENTER.
01:33
  1. mitmproxy shows all path components line by line, in our example its just Dunedin.
01:41
  1. Press ENTER to modify the selected path component.
01:48
  1. Replace Dunedin with Innsbruck.
01:54
  1. Press ESC to confirm your change.
02:04
  1. Press q to go back to the flow details view.
02:08
  1. Press a to resume the intercepted flow.
02:13
  1. You see that the request URL was modified and wttr.in replied with the weather report for Innsbruck.
02:19
  1. In the next lesson you will learn to replay flows.
02:27

In the next lesson, you will learn to replay previous flows.