From e2b7abb89825ed57cd35553bade766dfde9fcbda Mon Sep 17 00:00:00 2001 From: Miroslav Date: Mon, 19 Feb 2018 00:14:42 +0200 Subject: Fix a bug with two-words contentview modes --- mitmproxy/tools/console/consoleaddons.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mitmproxy/tools/console/consoleaddons.py b/mitmproxy/tools/console/consoleaddons.py index 03f2e240..e7cd40e7 100644 --- a/mitmproxy/tools/console/consoleaddons.py +++ b/mitmproxy/tools/console/consoleaddons.py @@ -498,10 +498,11 @@ class ConsoleAddon: @command.command("console.flowview.mode.set") @command.argument("mode", type=mitmproxy.types.Choice("console.flowview.mode.options")) - def flowview_mode_set(self, mode: str) -> None: + def flowview_mode_set(self, *mode: str) -> None: """ Set the display mode for the current flow view. """ + mode = " ".join(mode) fv = self.master.window.current_window("flowview") if not fv: raise exceptions.CommandError("Not viewing a flow.") -- cgit v1.2.3 From 4e03326ec5e26f9b9584fe980a196d034595d182 Mon Sep 17 00:00:00 2001 From: Miroslav Date: Mon, 19 Feb 2018 23:31:26 +0200 Subject: quotes instead of join --- mitmproxy/tools/console/consoleaddons.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mitmproxy/tools/console/consoleaddons.py b/mitmproxy/tools/console/consoleaddons.py index e7cd40e7..e8979b01 100644 --- a/mitmproxy/tools/console/consoleaddons.py +++ b/mitmproxy/tools/console/consoleaddons.py @@ -259,7 +259,7 @@ class ConsoleAddon: def callback(opt): # We're now outside of the call context... - repl = " ".join(args) + repl = "\"" + " ".join(args) + "\"" repl = repl.replace("{choice}", opt) try: self.master.commands.call(subcmd + " " + repl) @@ -498,11 +498,10 @@ class ConsoleAddon: @command.command("console.flowview.mode.set") @command.argument("mode", type=mitmproxy.types.Choice("console.flowview.mode.options")) - def flowview_mode_set(self, *mode: str) -> None: + def flowview_mode_set(self, mode: str) -> None: """ Set the display mode for the current flow view. """ - mode = " ".join(mode) fv = self.master.window.current_window("flowview") if not fv: raise exceptions.CommandError("Not viewing a flow.") -- cgit v1.2.3 From d6d2f55a4f4f36519192706501880f11aa0b7217 Mon Sep 17 00:00:00 2001 From: Miroslav Date: Mon, 19 Feb 2018 23:50:46 +0200 Subject: shlex.quote --- mitmproxy/tools/console/consoleaddons.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mitmproxy/tools/console/consoleaddons.py b/mitmproxy/tools/console/consoleaddons.py index e8979b01..c73eda42 100644 --- a/mitmproxy/tools/console/consoleaddons.py +++ b/mitmproxy/tools/console/consoleaddons.py @@ -1,4 +1,5 @@ import csv +import shlex import typing from mitmproxy import ctx @@ -259,7 +260,7 @@ class ConsoleAddon: def callback(opt): # We're now outside of the call context... - repl = "\"" + " ".join(args) + "\"" + repl = shlex.quote(" ".join(args)) repl = repl.replace("{choice}", opt) try: self.master.commands.call(subcmd + " " + repl) -- cgit v1.2.3