aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy
diff options
context:
space:
mode:
authorItai Sadan <itaisod@gmail.com>2020-01-18 10:44:00 +0200
committerItai Sadan <itaisod@gmail.com>2020-01-18 10:44:00 +0200
commit0afd0c933b7b5a3654cb6a9e27e8e24dbedcd789 (patch)
tree9a82ae2a7211c122db804eafec008f00f0871c95 /mitmproxy
parentf2c0f598b5224f8e3fbe94dc5817ab861b0a8438 (diff)
downloadmitmproxy-0afd0c933b7b5a3654cb6a9e27e8e24dbedcd789.tar.gz
mitmproxy-0afd0c933b7b5a3654cb6a9e27e8e24dbedcd789.tar.bz2
mitmproxy-0afd0c933b7b5a3654cb6a9e27e8e24dbedcd789.zip
consoleaddons.py - add command_lexer.quote where it seems relevant
Diffstat (limited to 'mitmproxy')
-rw-r--r--mitmproxy/tools/console/consoleaddons.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/mitmproxy/tools/console/consoleaddons.py b/mitmproxy/tools/console/consoleaddons.py
index ac92c96f..8e99566d 100644
--- a/mitmproxy/tools/console/consoleaddons.py
+++ b/mitmproxy/tools/console/consoleaddons.py
@@ -160,7 +160,7 @@ class ConsoleAddon:
fv = self.master.window.current("options")
if not fv:
raise exceptions.CommandError("Not viewing options.")
- self.master.commands.execute("options.reset.one %s" % fv.current_name())
+ self.master.commands.execute("options.reset.one %s" % command_lexer.quote(fv.current_name()))
@command.command("console.nav.start")
def nav_start(self) -> None:
@@ -280,8 +280,9 @@ class ConsoleAddon:
try:
self.master.commands.execute(subcmd + " " + repl)
except exceptions.CommandError as e:
- ctx.log.error(str(e))
- signals.status_message.send(message=str(e))
+ msg = str(e)
+ ctx.log.error(msg)
+ signals.status_message.send(message=msg)
self.master.overlay(
overlay.Chooser(self.master, prompt, choices, "", callback)
@@ -455,7 +456,7 @@ class ConsoleAddon:
flow.request.url = url.decode()
elif flow_part in ["method", "status_code", "reason"]:
self.master.commands.execute(
- "console.command flow.set @focus %s " % flow_part
+ "console.command flow.set @focus %s " % command_lexer.quote(flow_part)
)
def _grideditor(self):
@@ -542,8 +543,9 @@ class ConsoleAddon:
cmd = 'view.settings.setval @focus flowview_mode_%s %s' % (idx, command_lexer.quote(mode))
self.master.commands.execute(cmd)
except exceptions.CommandError as e:
- ctx.log.error(e)
- signals.status_message.send(message=str(e))
+ msg = str(e)
+ ctx.log.error(msg)
+ signals.status_message.send(message=msg)
@command.command("console.flowview.mode.options")
def flowview_mode_options(self) -> typing.Sequence[str]:
@@ -562,7 +564,7 @@ class ConsoleAddon:
raise exceptions.CommandError("Not viewing a flow.")
idx = fv.body.tab_offset
- cmd = 'view.settings.getval @focus flowview_mode_%s %s' % (idx, self.master.options.console_default_contentview)
+ cmd = 'view.settings.getval @focus flowview_mode_%s %s' % (idx, command_lexer.quote(self.master.options.console_default_contentview))
return self.master.commands.execute(cmd)
@command.command("console.key.contexts")