From 45e5cf8dc3ca936e2db8e7e45689d0a3331aad43 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Thu, 8 Sep 2022 17:59:40 +0200 Subject: [proxy] make package auto-installation work --- src/hydrilla/proxy/addon.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/hydrilla/proxy/addon.py') 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: -- cgit v1.2.3