aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/tools
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-08-16 22:52:02 +0200
committerGitHub <noreply@github.com>2017-08-16 22:52:02 +0200
commita006cab5cee773c60355660b4b44b702b4d51321 (patch)
treebca3caa8bb035bf3cadd70d48d0b3af85537f9bd /mitmproxy/tools
parent7c650aa53bc947207b2fcd0cbf195ba83a64252e (diff)
parent56781a0b08a0453fef0ff3f34d06c41c378cd7bc (diff)
downloadmitmproxy-a006cab5cee773c60355660b4b44b702b4d51321.tar.gz
mitmproxy-a006cab5cee773c60355660b4b44b702b4d51321.tar.bz2
mitmproxy-a006cab5cee773c60355660b4b44b702b4d51321.zip
Merge pull request #2489 from MatthewShao/options-into-own-addon
Move console-related options into their own addon
Diffstat (limited to 'mitmproxy/tools')
-rw-r--r--mitmproxy/tools/cmdline.py2
-rw-r--r--mitmproxy/tools/console/consoleaddons.py48
-rw-r--r--mitmproxy/tools/console/eventlog.py6
-rw-r--r--mitmproxy/tools/console/statusbar.py6
4 files changed, 58 insertions, 4 deletions
diff --git a/mitmproxy/tools/cmdline.py b/mitmproxy/tools/cmdline.py
index 93ce6f24..d611a8d2 100644
--- a/mitmproxy/tools/cmdline.py
+++ b/mitmproxy/tools/cmdline.py
@@ -48,7 +48,7 @@ def common_options(parser, opts):
)
parser.add_argument(
"-v", "--verbose",
- action="store_const", dest="verbose", const=3,
+ action="store_const", dest="verbose", const='debug',
help="Increase log verbosity."
)
diff --git a/mitmproxy/tools/console/consoleaddons.py b/mitmproxy/tools/console/consoleaddons.py
index 853447cf..49934e4d 100644
--- a/mitmproxy/tools/console/consoleaddons.py
+++ b/mitmproxy/tools/console/consoleaddons.py
@@ -11,6 +11,26 @@ from mitmproxy.tools.console import overlay
from mitmproxy.tools.console import signals
from mitmproxy.tools.console import keymap
+console_palettes = [
+ "lowlight",
+ "lowdark",
+ "light",
+ "dark",
+ "solarized_light",
+ "solarized_dark"
+]
+view_orders = [
+ "time",
+ "method",
+ "url",
+ "size",
+]
+console_layouts = [
+ "single",
+ "vertical",
+ "horizontal",
+]
+
class Logger:
def log(self, evt):
@@ -60,6 +80,34 @@ class ConsoleAddon:
self.master = master
self.started = False
+ def load(self, loader):
+ loader.add_option(
+ "console_layout", str, "single",
+ "Console layout.",
+ choices=sorted(console_layouts),
+ )
+ loader.add_option(
+ "console_layout_headers", bool, True,
+ "Show layout comonent headers",
+ )
+ loader.add_option(
+ "console_focus_follow", bool, False,
+ "Focus follows new flows."
+ )
+ loader.add_option(
+ "console_palette", str, "solarized_dark",
+ "Color palette.",
+ choices=sorted(console_palettes),
+ )
+ loader.add_option(
+ "console_palette_transparent", bool, False,
+ "Set transparent background for palette."
+ )
+ loader.add_option(
+ "console_mouse", bool, True,
+ "Console mouse interaction."
+ )
+
@command.command("console.layout.options")
def layout_options(self) -> typing.Sequence[str]:
"""
diff --git a/mitmproxy/tools/console/eventlog.py b/mitmproxy/tools/console/eventlog.py
index a76b910e..c3e5dd39 100644
--- a/mitmproxy/tools/console/eventlog.py
+++ b/mitmproxy/tools/console/eventlog.py
@@ -22,6 +22,12 @@ class EventLog(urwid.ListBox, layoutwidget.LayoutWidget):
signals.sig_add_log.connect(self.sig_add_log)
signals.sig_clear_log.connect(self.sig_clear_log)
+ def load(self, loader):
+ loader.add_option(
+ "console_focus_follow", bool, False,
+ "Focus follows new flows."
+ )
+
def set_focus(self, index):
if 0 <= index < len(self.walker):
super().set_focus(index)
diff --git a/mitmproxy/tools/console/statusbar.py b/mitmproxy/tools/console/statusbar.py
index 5bfc611c..795b3d8a 100644
--- a/mitmproxy/tools/console/statusbar.py
+++ b/mitmproxy/tools/console/statusbar.py
@@ -199,10 +199,10 @@ class StatusBar(urwid.WidgetWrap):
r.append("[")
r.append(("heading_key", "M"))
r.append(":%s]" % self.master.options.default_contentview)
- if self.master.options.has_changed("console_order"):
+ if self.master.options.has_changed("view_order"):
r.append("[")
r.append(("heading_key", "o"))
- r.append(":%s]" % self.master.options.console_order)
+ r.append(":%s]" % self.master.options.view_order)
opts = []
if self.master.options.anticache:
@@ -244,7 +244,7 @@ class StatusBar(urwid.WidgetWrap):
else:
offset = self.master.view.focus.index + 1
- if self.master.options.console_order_reversed:
+ if self.master.options.view_order_reversed:
arrow = common.SYMBOL_UP
else:
arrow = common.SYMBOL_DOWN