aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/filt/filt.peg
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-01-24 17:03:09 +0100
committerGitHub <noreply@github.com>2017-01-24 17:03:09 +0100
commite076c23f8daf01d2acddd8e836366d652e0e0dce (patch)
treedaf775952eebc5ce12a752246efc096f12287b88 /web/src/js/filt/filt.peg
parentacfd548fa239a6e36b8b0c5a197a5c6314494be6 (diff)
parent15482e3242162b69fe519b4f4f92c17b78400fe3 (diff)
downloadmitmproxy-e076c23f8daf01d2acddd8e836366d652e0e0dce.tar.gz
mitmproxy-e076c23f8daf01d2acddd8e836366d652e0e0dce.tar.bz2
mitmproxy-e076c23f8daf01d2acddd8e836366d652e0e0dce.zip
Merge pull request #1957 from s4chin/add-body-filters
web: Add body filters
Diffstat (limited to 'web/src/js/filt/filt.peg')
-rw-r--r--web/src/js/filt/filt.peg27
1 files changed, 27 insertions, 0 deletions
diff --git a/web/src/js/filt/filt.peg b/web/src/js/filt/filt.peg
index 64780d8a..989bfdd3 100644
--- a/web/src/js/filt/filt.peg
+++ b/web/src/js/filt/filt.peg
@@ -69,6 +69,30 @@ function responseCode(code){
responseCodeFilter.desc = "resp. code is " + code;
return responseCodeFilter;
}
+function body(regex){
+ regex = new RegExp(regex, "i");
+ function bodyFilter(flow){
+ return True;
+ }
+ bodyFilter.desc = "body filters are not implemented yet, see https://github.com/mitmproxy/mitmweb/issues/10";
+ return bodyFilter;
+}
+function requestBody(regex){
+ regex = new RegExp(regex, "i");
+ function requestBodyFilter(flow){
+ return True;
+ }
+ requestBodyFilter.desc = "body filters are not implemented yet, see https://github.com/mitmproxy/mitmweb/issues/10";
+ return requestBodyFilter;
+}
+function responseBody(regex){
+ regex = new RegExp(regex, "i");
+ function responseBodyFilter(flow){
+ return True;
+ }
+ responseBodyFilter.desc = "body filters are not implemented yet, see https://github.com/mitmproxy/mitmweb/issues/10";
+ return responseBodyFilter;
+}
function domain(regex){
regex = new RegExp(regex, "i");
function domainFilter(flow){
@@ -233,6 +257,9 @@ Expr
= "true" { return trueFilter; }
/ "false" { return falseFilter; }
/ "~a" { return assetFilter; }
+ / "~b" ws+ s:StringLiteral { return body(s); }
+ / "~bq" ws+ s:StringLiteral { return requestBody(s); }
+ / "~bs" ws+ s:StringLiteral { return responseBody(s); }
/ "~c" ws+ s:IntegerLiteral { return responseCode(s); }
/ "~d" ws+ s:StringLiteral { return domain(s); }
/ "~dst" ws+ s:StringLiteral { return destination(s); }