From 879c41927171efc8d77d1de2739b18e2eb57580f Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Wed, 27 Jul 2022 15:56:24 +0200 Subject: unfinished partial work --- src/hydrilla/mitmproxy_launcher/__init__.py | 5 +++++ src/hydrilla/mitmproxy_launcher/launch.py | 16 +++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 src/hydrilla/mitmproxy_launcher/__init__.py (limited to 'src/hydrilla/mitmproxy_launcher') diff --git a/src/hydrilla/mitmproxy_launcher/__init__.py b/src/hydrilla/mitmproxy_launcher/__init__.py new file mode 100644 index 0000000..d382ead --- /dev/null +++ b/src/hydrilla/mitmproxy_launcher/__init__.py @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: CC0-1.0 + +# Copyright (C) 2022 Wojtek Kosior +# +# Available under the terms of Creative Commons Zero v1.0 Universal. diff --git a/src/hydrilla/mitmproxy_launcher/launch.py b/src/hydrilla/mitmproxy_launcher/launch.py index c826598..765a9ce 100644 --- a/src/hydrilla/mitmproxy_launcher/launch.py +++ b/src/hydrilla/mitmproxy_launcher/launch.py @@ -42,6 +42,12 @@ import click from .. import _version from ..translations import smart_gettext as _ +addon_script_text = ''' +from hydrilla.proxy.addon import HaketiloAddon + +addons = [HaketiloAddon()] +''' + @click.command(help=_('cli_help.haketilo')) @click.option('-p', '--port', default=8080, type=click.IntRange(0, 65535), help=_('cli_opt.haketilo.port')) @@ -61,17 +67,13 @@ def launch(port: int, directory: str): script_path = directory_path / 'addon.py' - script_path.write_text(''' -from hydrilla.mitmproxy_addon.addon import Haketilo - -addons = [Haketilo()] -''') + script_path.write_text(addon_script_text) code = sp.call(['mitmdump', '-p', str(port), - '--set', f'confdir={directory_path / "mitmproxy"}' + '--set', f'confdir={directory_path / "mitmproxy"}', '--set', 'upstream_cert=false', - '--set', f'haketilo_dir={directory_path}' + '--set', f'haketilo_dir={directory_path}', '--scripts', str(script_path)]) sys.exit(code) -- cgit v1.2.3