From 0d6de19b070789405ed2713b6d973b06ea7922fc Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 6 Apr 2015 17:27:46 +1200 Subject: console: sticky cookies and auth to options screen --- libmproxy/console/help.py | 4 +--- libmproxy/console/options.py | 26 ++++++++++++++++++++++++-- libmproxy/console/window.py | 12 ------------ libmproxy/flow.py | 6 +++--- 4 files changed, 28 insertions(+), 20 deletions(-) (limited to 'libmproxy') diff --git a/libmproxy/console/help.py b/libmproxy/console/help.py index 53296df9..0da29907 100644 --- a/libmproxy/console/help.py +++ b/libmproxy/console/help.py @@ -39,11 +39,9 @@ class HelpView(urwid.ListBox): ("c", "client replay"), ("i", "set interception pattern"), ("o", "options"), - ("q", "quit / return to flow list"), + ("q", "quit / return to previous page"), ("Q", "quit without confirm prompt"), ("S", "server replay"), - ("t", "set sticky cookie expression"), - ("u", "set sticky auth expression"), ] text.extend( common.format_keyvals(keys, key="key", val="text", indent=4) diff --git a/libmproxy/console/options.py b/libmproxy/console/options.py index bfe6a591..7a03f718 100644 --- a/libmproxy/console/options.py +++ b/libmproxy/console/options.py @@ -212,11 +212,15 @@ class Options(urwid.WidgetWrap): ), Option( "Sticky Auth", - "A" + "A", + lambda: master.stickyauth_txt, + self.sticky_auth ), Option( "Sticky Cookies", - "t" + "t", + lambda: master.stickycookie_txt, + self.sticky_cookie ), ] ) @@ -247,6 +251,10 @@ class Options(urwid.WidgetWrap): self.master.set_ignore_filter([]) self.master.set_tcp_filter([]) self.master.scripts = [] + self.master.set_stickyauth(None) + self.master.set_stickycookie(None) + self.master.state.default_body_view = contentview.get("Auto") + signals.update_settings.send(self) signals.status_message.send( message = "All options cleared", @@ -340,3 +348,17 @@ class Options(urwid.WidgetWrap): _set ) ) + + def sticky_auth(self): + signals.status_prompt.send( + prompt = "Sticky auth filter", + text = self.master.stickyauth_txt, + callback = self.master.set_stickyauth + ) + + def sticky_cookie(self): + signals.status_prompt.send( + prompt = "Sticky cookie filter", + text = self.master.stickycookie_txt, + callback = self.master.set_stickycookie + ) diff --git a/libmproxy/console/window.py b/libmproxy/console/window.py index cdc57b17..af9da81f 100644 --- a/libmproxy/console/window.py +++ b/libmproxy/console/window.py @@ -63,17 +63,5 @@ class Window(urwid.Frame): ), callback = self.master.stop_server_playback_prompt, ) - elif k == "t": - signals.status_prompt.send( - prompt = "Sticky cookie filter", - text = self.master.stickycookie_txt, - callback = self.master.set_stickycookie - ) - elif k == "u": - signals.status_prompt.send( - prompt = "Sticky auth filter", - text = self.master.stickyauth_txt, - callback = self.master.set_stickyauth - ) else: return k diff --git a/libmproxy/flow.py b/libmproxy/flow.py index eb8ee16a..680b6a20 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -736,7 +736,7 @@ class FlowMaster(controller.Master): ignore_payload_params: list of content params to ignore in server replay ignore_host: true if request host should be ignored in server replay """ - self.server_playback = ServerPlaybackState(headers, flows, exit, nopop, + self.server_playback = ServerPlaybackState(headers, flows, exit, nopop, ignore_params, ignore_content, ignore_payload_params, ignore_host) self.kill_nonreplay = kill @@ -786,7 +786,7 @@ class FlowMaster(controller.Master): def create_request(self, method, scheme, host, port, path): """ this method creates a new artificial and minimalist request also adds it to flowlist - """ + """ c = ClientConnection.from_state(dict( address=dict(address=(host, port), use_ipv6=False), clientcert=None @@ -802,7 +802,7 @@ class FlowMaster(controller.Master): )) f = http.HTTPFlow(c,s); headers = ODictCaseless() - + req = http.HTTPRequest("absolute", method, scheme, host, port, path, (1, 1), headers, None, None, None, None) f.request = req -- cgit v1.2.3