diff options
author | Aldo Cortesi <aldo@corte.si> | 2018-07-11 10:24:52 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-11 10:24:52 +1200 |
commit | 9829fe150e7d5ef115f0910756daeefd0740e77d (patch) | |
tree | 53f5dd79a137f67aafe299eaa1028f85509b8c47 | |
parent | 81fa45450c6d48dd42326ace57d7eb849e27c795 (diff) | |
parent | ba02a0b8b9a068697b39b0f6c7ac36a2a479e0bc (diff) | |
download | mitmproxy-9829fe150e7d5ef115f0910756daeefd0740e77d.tar.gz mitmproxy-9829fe150e7d5ef115f0910756daeefd0740e77d.tar.bz2 mitmproxy-9829fe150e7d5ef115f0910756daeefd0740e77d.zip |
Merge pull request #3186 from andersonvom/master
Add scripting example to intercept & change requests
-rw-r--r-- | docs/src/content/addons-scripting.md | 17 | ||||
-rw-r--r-- | examples/addons/scripting-headers.py (renamed from examples/addons/scripting.py) | 0 |
2 files changed, 16 insertions, 1 deletions
diff --git a/docs/src/content/addons-scripting.md b/docs/src/content/addons-scripting.md index e31d291a..4e9916ca 100644 --- a/docs/src/content/addons-scripting.md +++ b/docs/src/content/addons-scripting.md @@ -14,4 +14,19 @@ handler functions in the module scope. For instance, here is a complete script that adds a header to every request. -{{< example src="examples/addons/scripting.py" lang="py" >}}
\ No newline at end of file +{{< example src="examples/addons/scripting-headers.py" lang="py" >}} + + +Here's another example that intercepts requests to a particular URL and sends +an arbitrary response instead: + +{{< example src="examples/simple/send_reply_from_proxy.py" lang="py" >}} + + +You can look at the [http][] module, or the [Request][], and +[Response][] classes for other attributes that you can use when +scripting. + +[http][]: https://github.com/mitmproxy/mitmproxy/blob/master/mitmproxy/http.py +[Request]: https://github.com/mitmproxy/mitmproxy/blob/master/mitmproxy/net/http/request.py +[Response]: https://github.com/mitmproxy/mitmproxy/blob/master/mitmproxy/net/http/response.py diff --git a/examples/addons/scripting.py b/examples/addons/scripting-headers.py index 8b23680e..8b23680e 100644 --- a/examples/addons/scripting.py +++ b/examples/addons/scripting-headers.py |