From 850a50262be8264fabe1d1a18b2985b70f7a86ae Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Wed, 15 Apr 2015 12:56:43 +1200 Subject: console: add a -l flag to set the limit on startup --- libmproxy/cmdline.py | 5 +++++ libmproxy/console/__init__.py | 4 ++++ libmproxy/console/grideditor.py | 6 ++++++ libmproxy/main.py | 1 + 4 files changed, 16 insertions(+) (limited to 'libmproxy') diff --git a/libmproxy/cmdline.py b/libmproxy/cmdline.py index 7ea9be8c..c68745a9 100644 --- a/libmproxy/cmdline.py +++ b/libmproxy/cmdline.py @@ -599,6 +599,11 @@ def mitmproxy(): type=str, dest="intercept", default=None, help="Intercept filter expression." ) + group.add_argument( + "-l", "--limit", action="store", + type=str, dest="limit", default=None, + help="Limit filter expression." + ) return parser diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py index 5c2402f6..f6e09f0f 100644 --- a/libmproxy/console/__init__.py +++ b/libmproxy/console/__init__.py @@ -116,6 +116,7 @@ class Options(object): "keepserving", "kill", "intercept", + "limit", "no_server", "refresh_server_playback", "rfile", @@ -162,6 +163,9 @@ class ConsoleMaster(flow.FlowMaster): print >> sys.stderr, "Intercept error:", r sys.exit(1) + if options.limit: + self.set_limit(options.limit) + r = self.set_stickycookie(options.stickycookie) if r: print >> sys.stderr, "Sticky cookies error:", r diff --git a/libmproxy/console/grideditor.py b/libmproxy/console/grideditor.py index 4cba0849..493268ba 100644 --- a/libmproxy/console/grideditor.py +++ b/libmproxy/console/grideditor.py @@ -549,3 +549,9 @@ class CookieEditor(GridEditor): title = "Editing request Cookie header" columns = 2 headings = ("Name", "Value") + + +class SetCookieEditor(GridEditor): + title = "Editing request SetCookie header" + columns = 2 + headings = ("Name", "Value") diff --git a/libmproxy/main.py b/libmproxy/main.py index 7d56a505..32ab738e 100644 --- a/libmproxy/main.py +++ b/libmproxy/main.py @@ -92,6 +92,7 @@ def mitmproxy(args=None): # pragma: nocover console_options.palette_transparent = options.palette_transparent console_options.eventlog = options.eventlog console_options.intercept = options.intercept + console_options.limit = options.limit server = get_server(console_options.no_server, proxy_config) -- cgit v1.2.3