Some addons which can be used for developing and testing client-server applications.
Run mitmproxy
with one or more addons:
$ mitmproxy \
-s replayserverex.py \
-s sleeper.py
Or while running:
: set scripts=replayserverex.py
Or via config.yaml:
scripts: [
'~/mitmproxy-addons/offline.py',
'~/mitmproxy-addons/sleeper.py'
]
Extensions for built in ServerPlayback addon.
Commands:
replay.server.file.add
- add flows to server playback from filereplay.server.list
- show server playback buffer
This addon allows to add a filter and for any flow matching it status code and contents of the response will be replaced.
For example, to replace any response from google.com
with a status code of 200
and contents from response.json
:
: replay.server.matchers.add google.com 200 response.json
Commands:
replay.server.matchers.add
- add a matcher for server playbackreplay.server.matchers.clear
- clear all matchersreplay.server.matchers.list
- show matchers list
Adds a delay before sending a request.
Options:
sleep
- delay client requests by this amount of time (milliseconds)sleep_filter
- delay only flows which match the filter
Simulate offline mode by killing all (or matching a filter) requests.
Options:
offline
- kill all flowsoffline_filter
- kill only flows matching the filter