diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-09-08 17:59:40 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-09-28 14:03:18 +0200 |
commit | 45e5cf8dc3ca936e2db8e7e45689d0a3331aad43 (patch) | |
tree | 83f0b13f0fbb6d29862ac91ac0597e1c5c64719e /src/hydrilla/proxy/addon.py | |
parent | 04853ff19450c5925a7c9bacc11abe90e75f8510 (diff) | |
download | haketilo-hydrilla-45e5cf8dc3ca936e2db8e7e45689d0a3331aad43.tar.gz haketilo-hydrilla-45e5cf8dc3ca936e2db8e7e45689d0a3331aad43.zip |
[proxy] make package auto-installation work
Diffstat (limited to 'src/hydrilla/proxy/addon.py')
-rw-r--r-- | src/hydrilla/proxy/addon.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/hydrilla/proxy/addon.py b/src/hydrilla/proxy/addon.py index c7fae7e..b9c4159 100644 --- a/src/hydrilla/proxy/addon.py +++ b/src/hydrilla/proxy/addon.py @@ -40,6 +40,7 @@ import traceback as tb from threading import Lock from pathlib import Path from contextlib import contextmanager +from urllib.parse import urlparse from mitmproxy import tls, http, addonmanager, ctx from mitmproxy.script import concurrent @@ -184,6 +185,14 @@ class HaketiloAddon: available at this point, so the handler effectively does nothing. """ with self.http_safe_event_handling(flow): + referrer = flow.request.headers.get('referer') + if referrer is not None: + if urlparse(referrer).netloc == 'hkt.mitm.it' and \ + urlparse(flow.request.url).netloc != 'hkt.mitm.it': + # Do not reveal to the site that Haketilo meta-site was + # visited before. + flow.request.headers.pop('referer', None) + policy = self.try_get_policy(flow) if policy is not None: |