From 965d318164f430a1b1680f205616954aac2faace Mon Sep 17 00:00:00 2001 From: "Mark E. Haase" Date: Wed, 28 Dec 2011 16:47:30 -0500 Subject: Help docs have ~r as an example but ~r isn't valid. I think it's supposed to be ~q. --- libmproxy/console.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libmproxy') diff --git a/libmproxy/console.py b/libmproxy/console.py index 337cd243..fb1a2ed0 100644 --- a/libmproxy/console.py +++ b/libmproxy/console.py @@ -1499,8 +1499,8 @@ class ConsoleMaster(flow.FlowMaster): ) examples = [ ("google\.com", "Url containing \"google.com"), - ("~r ~b test", "Requests where body contains \"test\""), - ("!(~r & ~t \"text/html\")", "Anything but requests with a text/html content type."), + ("~q ~b test", "Requests where body contains \"test\""), + ("!(~q & ~t \"text/html\")", "Anything but requests with a text/html content type."), ] text.extend(format_keyvals(examples, key="key", val="text", indent=4)) return urwid.ListBox([urwid.Text(text)]) -- cgit v1.2.3 From 05111f093d66d5a277a69e8a610e4bf10ca249c6 Mon Sep 17 00:00:00 2001 From: "Mark E. Haase" Date: Wed, 28 Dec 2011 17:32:29 -0500 Subject: Add support for filtering by HTTP method (get, post, etc.) using ~m operator. --- libmproxy/filt.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'libmproxy') diff --git a/libmproxy/filt.py b/libmproxy/filt.py index bf7d20c1..b5af44de 100644 --- a/libmproxy/filt.py +++ b/libmproxy/filt.py @@ -34,6 +34,7 @@ ~bq rex Expression in the body of response ~t rex Shortcut for content-type header. + ~m rex Method ~u rex URL ~c CODE Response code. rex Equivalent to ~u rex @@ -178,7 +179,18 @@ class FBodResponse(_Rex): elif o.content and re.search(self.expr, o.content): return True return False - + + +class FMethod(_Rex): + code = "m" + help = "Method" + def __call__(self, o): + if o._is_response(): + return False + elif o.method: + return re.search(self.expr, o.method, re.IGNORECASE) + return False + class FUrl(_Rex): code = "u" @@ -260,6 +272,7 @@ filt_rex = [ FBodRequest, FBodResponse, FBod, + FMethod, FUrl, FRequestContentType, FResponseContentType, -- cgit v1.2.3