2020-06-22 23:53:39 +00:00
|
|
|
"""Take incoming HTTP requests and replay them with modified parameters."""
|
2016-10-26 05:06:52 +00:00
|
|
|
from mitmproxy import ctx
|
2016-07-08 01:37:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
def request(flow):
|
2018-05-04 21:34:22 +00:00
|
|
|
# Avoid an infinite loop by not replaying already replayed requests
|
2020-07-16 13:00:41 +00:00
|
|
|
if flow.is_replay == "request":
|
2018-05-04 21:34:22 +00:00
|
|
|
return
|
|
|
|
flow = flow.copy()
|
|
|
|
# Only interactive tools have a view. If we have one, add a duplicate entry
|
|
|
|
# for our flow.
|
|
|
|
if "view" in ctx.master.addons:
|
2018-06-13 09:56:14 +00:00
|
|
|
ctx.master.commands.call("view.flows.add", [flow])
|
2018-05-04 21:34:22 +00:00
|
|
|
flow.request.path = "/changed"
|
|
|
|
ctx.master.commands.call("replay.client", [flow])
|