aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/console.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2011-03-20 17:31:54 +1300
committerAldo Cortesi <aldo@nullcube.com>2011-03-20 17:31:54 +1300
commitc726519e73761e5df3a20a1a92c1655497dd49c0 (patch)
tree4eaf05e205d9613de3aa499f8225e75d28f3d30f /libmproxy/console.py
parent4f877cde6a9a6b99c3bf452f2164ab09abc64d50 (diff)
downloadmitmproxy-c726519e73761e5df3a20a1a92c1655497dd49c0.tar.gz
mitmproxy-c726519e73761e5df3a20a1a92c1655497dd49c0.tar.bz2
mitmproxy-c726519e73761e5df3a20a1a92c1655497dd49c0.zip
Add a stickyauth option.
This allows us to replay an HTTP Authorization header, in the same way as we replay cookies using stickycookies. This lets us conveniently get at HTTP Basic Auth protected resources through the proxy, but is not enough to do the same for HTTP Digest auth. We'll put that on the todo list.
Diffstat (limited to 'libmproxy/console.py')
-rw-r--r--libmproxy/console.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/libmproxy/console.py b/libmproxy/console.py
index 46bd0078..bbf69d2d 100644
--- a/libmproxy/console.py
+++ b/libmproxy/console.py
@@ -635,6 +635,10 @@ class StatusBar(WWrap):
r.append("[")
r.append(("statusbar_highlight", "t"))
r.append(":%s]"%self.master.stickycookie_txt)
+ if self.master.stickyauth_txt:
+ r.append("[")
+ r.append(("statusbar_highlight", "u"))
+ r.append(":%s]"%self.master.stickyauth_txt)
opts = []
if self.master.anticache:
@@ -773,6 +777,7 @@ class Options(object):
"rheaders",
"server_replay",
"stickycookie",
+ "stickyauth",
"verbosity",
"wfile",
]
@@ -828,8 +833,10 @@ class ConsoleMaster(flow.FlowMaster):
print >> sys.stderr, "Sticky cookies error:", r
sys.exit(1)
- self.stickycookie = None
- self.stickyhosts = {}
+ r = self.set_stickyauth(options.stickyauth)
+ if r:
+ print >> sys.stderr, "Sticky auth error:", r
+ sys.exit(1)
self.refresh_server_playback = options.refresh_server_playback
self.anticache = options.anticache
@@ -1136,6 +1143,7 @@ class ConsoleMaster(flow.FlowMaster):
("S", "save all flows matching current limit"),
("s", "server replay"),
("t", "set sticky cookie expression"),
+ ("u", "set sticky auth expression"),
("w", "save this flow"),
("page up/down", "page up/down"),
("enter", "view connection"),
@@ -1410,6 +1418,13 @@ class ConsoleMaster(flow.FlowMaster):
self.set_stickycookie
)
k = None
+ elif k == "u":
+ self.prompt(
+ "Sticky auth filter: ",
+ self.stickyauth_txt,
+ self.set_stickyauth
+ )
+ k = None
if k:
self.view.keypress(size, k)
except (Stop, KeyboardInterrupt):