diff --git a/examples/README b/examples/README index 24b5c2fe1..9ea6f9a26 100644 --- a/examples/README +++ b/examples/README @@ -1,6 +1,8 @@ add_header.py Simple script that just adds a header to every request. +dup_and_replay.py Duplicates each request, changes it, and then replays the modified request. flowbasic Basic use of mitmproxy as a library. modify_form.py Modify all form submissions to add a parameter. +modify_querystring.py Modify all query strings to add a parameters. stub.py Script stub with a method definition for every event. stickycookies An example of writing a custom proxy with libmproxy. upsidedownternet.py Rewrites traffic to turn PNGs upside down. diff --git a/examples/dup_and_replay.py b/examples/dup_and_replay.py new file mode 100644 index 000000000..9c58d3a4d --- /dev/null +++ b/examples/dup_and_replay.py @@ -0,0 +1,4 @@ +def request(ctx, flow): + f = ctx.duplicate_flow(flow) + f.request.path = "/changed" + ctx.replay_request(f) diff --git a/examples/modify_querystring.py b/examples/modify_querystring.py new file mode 100644 index 000000000..b1abcc1ee --- /dev/null +++ b/examples/modify_querystring.py @@ -0,0 +1,7 @@ + +def request(context, flow): + q = flow.request.get_query() + if q: + q["mitmproxy"] = ["rocks"] + flow.request.set_query(q) +