Add two more examples: dup_and_replay.py and modify_querystring.py

This commit is contained in:
Aldo Cortesi 2012-02-23 15:43:04 +13:00
parent bc3bf969ba
commit 62ca9b71ff
3 changed files with 13 additions and 0 deletions

View File

@ -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.

View File

@ -0,0 +1,4 @@
def request(ctx, flow):
f = ctx.duplicate_flow(flow)
f.request.path = "/changed"
ctx.replay_request(f)

View File

@ -0,0 +1,7 @@
def request(context, flow):
q = flow.request.get_query()
if q:
q["mitmproxy"] = ["rocks"]
flow.request.set_query(q)