diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-11-21 02:45:31 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-11-21 02:46:25 +0100 |
commit | c90405253a2345b7722bdb68906561e4c50dc1bf (patch) | |
tree | 6aca193818ddfac70fc8df3d314c36402444e33e /examples/complex | |
parent | 2138be870579d79380f73cda849ab27a9432485c (diff) | |
download | mitmproxy-c90405253a2345b7722bdb68906561e4c50dc1bf.tar.gz mitmproxy-c90405253a2345b7722bdb68906561e4c50dc1bf.tar.bz2 mitmproxy-c90405253a2345b7722bdb68906561e4c50dc1bf.zip |
remove stickycookie example
The recommended way to do this is mitmproxy/addons/stickycookie.py
Diffstat (limited to 'examples/complex')
-rw-r--r-- | examples/complex/README.md | 1 | ||||
-rw-r--r-- | examples/complex/stickycookies | 42 |
2 files changed, 0 insertions, 43 deletions
diff --git a/examples/complex/README.md b/examples/complex/README.md index d3b2e77a..8378690c 100644 --- a/examples/complex/README.md +++ b/examples/complex/README.md @@ -12,7 +12,6 @@ | nonblocking.py | Demonstrate parallel processing with a blocking script | | remote_debug.py | This script enables remote debugging of the mitmproxy _UI_ with PyCharm. | | sslstrip.py | sslstrip-like funtionality implemented with mitmproxy | -| stickycookies | An advanced example of using mitmproxy's FlowMaster directly. | | stream | Enable streaming for all responses. | | stream_modify.py | Modify a streamed response body. | | tcp_message.py | Modify a raw TCP connection | diff --git a/examples/complex/stickycookies b/examples/complex/stickycookies deleted file mode 100644 index 4631fa73..00000000 --- a/examples/complex/stickycookies +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python -""" -This example builds on mitmproxy's base proxying infrastructure to -implement functionality similar to the "sticky cookies" option. - -Heads Up: In the majority of cases, you want to use inline scripts. -""" -import os -from mitmproxy import controller, proxy, master -from mitmproxy.proxy.server import ProxyServer - - -class StickyMaster(master.Master): - def __init__(self, server): - master.Master.__init__(self, server) - self.stickyhosts = {} - - def run(self): - try: - return master.Master.run(self) - except KeyboardInterrupt: - self.shutdown() - - @controller.handler - def request(self, flow): - hid = (flow.request.host, flow.request.port) - if "cookie" in flow.request.headers: - self.stickyhosts[hid] = flow.request.headers.get_all("cookie") - elif hid in self.stickyhosts: - flow.request.headers.set_all("cookie", self.stickyhosts[hid]) - - @controller.handler - def response(self, flow): - hid = (flow.request.host, flow.request.port) - if "set-cookie" in flow.response.headers: - self.stickyhosts[hid] = flow.response.headers.get_all("set-cookie") - - -config = proxy.ProxyConfig(port=8080) -server = ProxyServer(config) -m = StickyMaster(server) -m.run() |