diff options
| author | Sachin Kelkar <sachinkel19@gmail.com> | 2017-01-20 20:45:07 +0530 | 
|---|---|---|
| committer | Sachin Kelkar <sachinkel19@gmail.com> | 2017-01-20 22:53:37 +0530 | 
| commit | bbda53c8b6422adddeaa2d12ab07ff38f57f0e4d (patch) | |
| tree | 606595c4d7041f8b134bfb6835c9737cbf8e3b69 /web/src/js | |
| parent | 2ca48e5d0861e1c8ed679a9bb6464c19a5dabedf (diff) | |
| download | mitmproxy-bbda53c8b6422adddeaa2d12ab07ff38f57f0e4d.tar.gz mitmproxy-bbda53c8b6422adddeaa2d12ab07ff38f57f0e4d.tar.bz2 mitmproxy-bbda53c8b6422adddeaa2d12ab07ff38f57f0e4d.zip | |
web: Add ~http and ~tcp filters
Diffstat (limited to 'web/src/js')
| -rw-r--r-- | web/src/js/filt/filt.js | 404 | ||||
| -rw-r--r-- | web/src/js/filt/filt.peg | 12 | 
2 files changed, 235 insertions, 181 deletions
| diff --git a/web/src/js/filt/filt.js b/web/src/js/filt/filt.js index e241d63f..f2c5ded2 100644 --- a/web/src/js/filt/filt.js +++ b/web/src/js/filt/filt.js @@ -65,82 +65,88 @@ module.exports = (function() {          peg$c26 = "~e",          peg$c27 = { type: "literal", value: "~e", description: "\"~e\"" },          peg$c28 = function() { return errorFilter; }, -        peg$c29 = "~q", -        peg$c30 = { type: "literal", value: "~q", description: "\"~q\"" }, -        peg$c31 = function() { return noResponseFilter; }, -        peg$c32 = "~s", -        peg$c33 = { type: "literal", value: "~s", description: "\"~s\"" }, -        peg$c34 = function() { return responseFilter; }, -        peg$c35 = "~marked", -        peg$c36 = { type: "literal", value: "~marked", description: "\"~marked\"" }, -        peg$c37 = function() { return markedFilter; }, -        peg$c38 = "true", -        peg$c39 = { type: "literal", value: "true", description: "\"true\"" }, -        peg$c40 = function() { return trueFilter; }, -        peg$c41 = "false", -        peg$c42 = { type: "literal", value: "false", description: "\"false\"" }, -        peg$c43 = function() { return falseFilter; }, -        peg$c44 = "~c", -        peg$c45 = { type: "literal", value: "~c", description: "\"~c\"" }, -        peg$c46 = function(s) { return responseCode(s); }, -        peg$c47 = "~d", -        peg$c48 = { type: "literal", value: "~d", description: "\"~d\"" }, -        peg$c49 = function(s) { return domain(s); }, -        peg$c50 = "~h", -        peg$c51 = { type: "literal", value: "~h", description: "\"~h\"" }, -        peg$c52 = function(s) { return header(s); }, -        peg$c53 = "~hq", -        peg$c54 = { type: "literal", value: "~hq", description: "\"~hq\"" }, -        peg$c55 = function(s) { return requestHeader(s); }, -        peg$c56 = "~hs", -        peg$c57 = { type: "literal", value: "~hs", description: "\"~hs\"" }, -        peg$c58 = function(s) { return responseHeader(s); }, -        peg$c59 = "~m", -        peg$c60 = { type: "literal", value: "~m", description: "\"~m\"" }, -        peg$c61 = function(s) { return method(s); }, -        peg$c62 = "~t", -        peg$c63 = { type: "literal", value: "~t", description: "\"~t\"" }, -        peg$c64 = function(s) { return contentType(s); }, -        peg$c65 = "~tq", -        peg$c66 = { type: "literal", value: "~tq", description: "\"~tq\"" }, -        peg$c67 = function(s) { return requestContentType(s); }, -        peg$c68 = "~ts", -        peg$c69 = { type: "literal", value: "~ts", description: "\"~ts\"" }, -        peg$c70 = function(s) { return responseContentType(s); }, -        peg$c71 = "~u", -        peg$c72 = { type: "literal", value: "~u", description: "\"~u\"" }, -        peg$c73 = function(s) { return url(s); }, -        peg$c74 = { type: "other", description: "integer" }, -        peg$c75 = /^['"]/, -        peg$c76 = { type: "class", value: "['\"]", description: "['\"]" }, -        peg$c77 = /^[0-9]/, -        peg$c78 = { type: "class", value: "[0-9]", description: "[0-9]" }, -        peg$c79 = function(digits) { return parseInt(digits.join(""), 10); }, -        peg$c80 = { type: "other", description: "string" }, -        peg$c81 = "\"", -        peg$c82 = { type: "literal", value: "\"", description: "\"\\\"\"" }, -        peg$c83 = function(chars) { return chars.join(""); }, -        peg$c84 = "'", -        peg$c85 = { type: "literal", value: "'", description: "\"'\"" }, -        peg$c86 = /^["\\]/, -        peg$c87 = { type: "class", value: "[\"\\\\]", description: "[\"\\\\]" }, -        peg$c88 = { type: "any", description: "any character" }, -        peg$c89 = function(char) { return char; }, -        peg$c90 = "\\", -        peg$c91 = { type: "literal", value: "\\", description: "\"\\\\\"" }, -        peg$c92 = /^['\\]/, -        peg$c93 = { type: "class", value: "['\\\\]", description: "['\\\\]" }, -        peg$c94 = /^['"\\]/, -        peg$c95 = { type: "class", value: "['\"\\\\]", description: "['\"\\\\]" }, -        peg$c96 = "n", -        peg$c97 = { type: "literal", value: "n", description: "\"n\"" }, -        peg$c98 = function() { return "\n"; }, -        peg$c99 = "r", -        peg$c100 = { type: "literal", value: "r", description: "\"r\"" }, -        peg$c101 = function() { return "\r"; }, -        peg$c102 = "t", -        peg$c103 = { type: "literal", value: "t", description: "\"t\"" }, -        peg$c104 = function() { return "\t"; }, +        peg$c29 = "~http", +        peg$c30 = { type: "literal", value: "~http", description: "\"~http\"" }, +        peg$c31 = function() { return httpFilter; }, +        peg$c32 = "~marked", +        peg$c33 = { type: "literal", value: "~marked", description: "\"~marked\"" }, +        peg$c34 = function() { return markedFilter; }, +        peg$c35 = "~q", +        peg$c36 = { type: "literal", value: "~q", description: "\"~q\"" }, +        peg$c37 = function() { return noResponseFilter; }, +        peg$c38 = "~s", +        peg$c39 = { type: "literal", value: "~s", description: "\"~s\"" }, +        peg$c40 = function() { return responseFilter; }, +        peg$c41 = "~tcp", +        peg$c42 = { type: "literal", value: "~tcp", description: "\"~tcp\"" }, +        peg$c43 = function() { return tcpFilter; }, +        peg$c44 = "true", +        peg$c45 = { type: "literal", value: "true", description: "\"true\"" }, +        peg$c46 = function() { return trueFilter; }, +        peg$c47 = "false", +        peg$c48 = { type: "literal", value: "false", description: "\"false\"" }, +        peg$c49 = function() { return falseFilter; }, +        peg$c50 = "~c", +        peg$c51 = { type: "literal", value: "~c", description: "\"~c\"" }, +        peg$c52 = function(s) { return responseCode(s); }, +        peg$c53 = "~d", +        peg$c54 = { type: "literal", value: "~d", description: "\"~d\"" }, +        peg$c55 = function(s) { return domain(s); }, +        peg$c56 = "~h", +        peg$c57 = { type: "literal", value: "~h", description: "\"~h\"" }, +        peg$c58 = function(s) { return header(s); }, +        peg$c59 = "~hq", +        peg$c60 = { type: "literal", value: "~hq", description: "\"~hq\"" }, +        peg$c61 = function(s) { return requestHeader(s); }, +        peg$c62 = "~hs", +        peg$c63 = { type: "literal", value: "~hs", description: "\"~hs\"" }, +        peg$c64 = function(s) { return responseHeader(s); }, +        peg$c65 = "~m", +        peg$c66 = { type: "literal", value: "~m", description: "\"~m\"" }, +        peg$c67 = function(s) { return method(s); }, +        peg$c68 = "~t", +        peg$c69 = { type: "literal", value: "~t", description: "\"~t\"" }, +        peg$c70 = function(s) { return contentType(s); }, +        peg$c71 = "~tq", +        peg$c72 = { type: "literal", value: "~tq", description: "\"~tq\"" }, +        peg$c73 = function(s) { return requestContentType(s); }, +        peg$c74 = "~ts", +        peg$c75 = { type: "literal", value: "~ts", description: "\"~ts\"" }, +        peg$c76 = function(s) { return responseContentType(s); }, +        peg$c77 = "~u", +        peg$c78 = { type: "literal", value: "~u", description: "\"~u\"" }, +        peg$c79 = function(s) { return url(s); }, +        peg$c80 = { type: "other", description: "integer" }, +        peg$c81 = /^['"]/, +        peg$c82 = { type: "class", value: "['\"]", description: "['\"]" }, +        peg$c83 = /^[0-9]/, +        peg$c84 = { type: "class", value: "[0-9]", description: "[0-9]" }, +        peg$c85 = function(digits) { return parseInt(digits.join(""), 10); }, +        peg$c86 = { type: "other", description: "string" }, +        peg$c87 = "\"", +        peg$c88 = { type: "literal", value: "\"", description: "\"\\\"\"" }, +        peg$c89 = function(chars) { return chars.join(""); }, +        peg$c90 = "'", +        peg$c91 = { type: "literal", value: "'", description: "\"'\"" }, +        peg$c92 = /^["\\]/, +        peg$c93 = { type: "class", value: "[\"\\\\]", description: "[\"\\\\]" }, +        peg$c94 = { type: "any", description: "any character" }, +        peg$c95 = function(char) { return char; }, +        peg$c96 = "\\", +        peg$c97 = { type: "literal", value: "\\", description: "\"\\\\\"" }, +        peg$c98 = /^['\\]/, +        peg$c99 = { type: "class", value: "['\\\\]", description: "['\\\\]" }, +        peg$c100 = /^['"\\]/, +        peg$c101 = { type: "class", value: "['\"\\\\]", description: "['\"\\\\]" }, +        peg$c102 = "n", +        peg$c103 = { type: "literal", value: "n", description: "\"n\"" }, +        peg$c104 = function() { return "\n"; }, +        peg$c105 = "r", +        peg$c106 = { type: "literal", value: "r", description: "\"r\"" }, +        peg$c107 = function() { return "\r"; }, +        peg$c108 = "t", +        peg$c109 = { type: "literal", value: "t", description: "\"t\"" }, +        peg$c110 = function() { return "\t"; },          peg$currPos          = 0,          peg$savedPos         = 0, @@ -693,9 +699,9 @@ module.exports = (function() {            s0 = s1;            if (s0 === peg$FAILED) {              s0 = peg$currPos; -            if (input.substr(peg$currPos, 2) === peg$c29) { +            if (input.substr(peg$currPos, 5) === peg$c29) {                s1 = peg$c29; -              peg$currPos += 2; +              peg$currPos += 5;              } else {                s1 = peg$FAILED;                if (peg$silentFails === 0) { peg$fail(peg$c30); } @@ -707,9 +713,9 @@ module.exports = (function() {              s0 = s1;              if (s0 === peg$FAILED) {                s0 = peg$currPos; -              if (input.substr(peg$currPos, 2) === peg$c32) { +              if (input.substr(peg$currPos, 7) === peg$c32) {                  s1 = peg$c32; -                peg$currPos += 2; +                peg$currPos += 7;                } else {                  s1 = peg$FAILED;                  if (peg$silentFails === 0) { peg$fail(peg$c33); } @@ -721,9 +727,9 @@ module.exports = (function() {                s0 = s1;                if (s0 === peg$FAILED) {                  s0 = peg$currPos; -                if (input.substr(peg$currPos, 7) === peg$c35) { +                if (input.substr(peg$currPos, 2) === peg$c35) {                    s1 = peg$c35; -                  peg$currPos += 7; +                  peg$currPos += 2;                  } else {                    s1 = peg$FAILED;                    if (peg$silentFails === 0) { peg$fail(peg$c36); } @@ -733,6 +739,36 @@ module.exports = (function() {                    s1 = peg$c37();                  }                  s0 = s1; +                if (s0 === peg$FAILED) { +                  s0 = peg$currPos; +                  if (input.substr(peg$currPos, 2) === peg$c38) { +                    s1 = peg$c38; +                    peg$currPos += 2; +                  } else { +                    s1 = peg$FAILED; +                    if (peg$silentFails === 0) { peg$fail(peg$c39); } +                  } +                  if (s1 !== peg$FAILED) { +                    peg$savedPos = s0; +                    s1 = peg$c40(); +                  } +                  s0 = s1; +                  if (s0 === peg$FAILED) { +                    s0 = peg$currPos; +                    if (input.substr(peg$currPos, 4) === peg$c41) { +                      s1 = peg$c41; +                      peg$currPos += 4; +                    } else { +                      s1 = peg$FAILED; +                      if (peg$silentFails === 0) { peg$fail(peg$c42); } +                    } +                    if (s1 !== peg$FAILED) { +                      peg$savedPos = s0; +                      s1 = peg$c43(); +                    } +                    s0 = s1; +                  } +                }                }              }            } @@ -746,30 +782,30 @@ module.exports = (function() {        var s0, s1;        s0 = peg$currPos; -      if (input.substr(peg$currPos, 4) === peg$c38) { -        s1 = peg$c38; +      if (input.substr(peg$currPos, 4) === peg$c44) { +        s1 = peg$c44;          peg$currPos += 4;        } else {          s1 = peg$FAILED; -        if (peg$silentFails === 0) { peg$fail(peg$c39); } +        if (peg$silentFails === 0) { peg$fail(peg$c45); }        }        if (s1 !== peg$FAILED) {          peg$savedPos = s0; -        s1 = peg$c40(); +        s1 = peg$c46();        }        s0 = s1;        if (s0 === peg$FAILED) {          s0 = peg$currPos; -        if (input.substr(peg$currPos, 5) === peg$c41) { -          s1 = peg$c41; +        if (input.substr(peg$currPos, 5) === peg$c47) { +          s1 = peg$c47;            peg$currPos += 5;          } else {            s1 = peg$FAILED; -          if (peg$silentFails === 0) { peg$fail(peg$c42); } +          if (peg$silentFails === 0) { peg$fail(peg$c48); }          }          if (s1 !== peg$FAILED) {            peg$savedPos = s0; -          s1 = peg$c43(); +          s1 = peg$c49();          }          s0 = s1;        } @@ -781,12 +817,12 @@ module.exports = (function() {        var s0, s1, s2, s3;        s0 = peg$currPos; -      if (input.substr(peg$currPos, 2) === peg$c44) { -        s1 = peg$c44; +      if (input.substr(peg$currPos, 2) === peg$c50) { +        s1 = peg$c50;          peg$currPos += 2;        } else {          s1 = peg$FAILED; -        if (peg$silentFails === 0) { peg$fail(peg$c45); } +        if (peg$silentFails === 0) { peg$fail(peg$c51); }        }        if (s1 !== peg$FAILED) {          s2 = []; @@ -803,7 +839,7 @@ module.exports = (function() {            s3 = peg$parseIntegerLiteral();            if (s3 !== peg$FAILED) {              peg$savedPos = s0; -            s1 = peg$c46(s3); +            s1 = peg$c52(s3);              s0 = s1;            } else {              peg$currPos = s0; @@ -819,12 +855,12 @@ module.exports = (function() {        }        if (s0 === peg$FAILED) {          s0 = peg$currPos; -        if (input.substr(peg$currPos, 2) === peg$c47) { -          s1 = peg$c47; +        if (input.substr(peg$currPos, 2) === peg$c53) { +          s1 = peg$c53;            peg$currPos += 2;          } else {            s1 = peg$FAILED; -          if (peg$silentFails === 0) { peg$fail(peg$c48); } +          if (peg$silentFails === 0) { peg$fail(peg$c54); }          }          if (s1 !== peg$FAILED) {            s2 = []; @@ -841,7 +877,7 @@ module.exports = (function() {              s3 = peg$parseStringLiteral();              if (s3 !== peg$FAILED) {                peg$savedPos = s0; -              s1 = peg$c49(s3); +              s1 = peg$c55(s3);                s0 = s1;              } else {                peg$currPos = s0; @@ -857,12 +893,12 @@ module.exports = (function() {          }          if (s0 === peg$FAILED) {            s0 = peg$currPos; -          if (input.substr(peg$currPos, 2) === peg$c50) { -            s1 = peg$c50; +          if (input.substr(peg$currPos, 2) === peg$c56) { +            s1 = peg$c56;              peg$currPos += 2;            } else {              s1 = peg$FAILED; -            if (peg$silentFails === 0) { peg$fail(peg$c51); } +            if (peg$silentFails === 0) { peg$fail(peg$c57); }            }            if (s1 !== peg$FAILED) {              s2 = []; @@ -879,7 +915,7 @@ module.exports = (function() {                s3 = peg$parseStringLiteral();                if (s3 !== peg$FAILED) {                  peg$savedPos = s0; -                s1 = peg$c52(s3); +                s1 = peg$c58(s3);                  s0 = s1;                } else {                  peg$currPos = s0; @@ -895,12 +931,12 @@ module.exports = (function() {            }            if (s0 === peg$FAILED) {              s0 = peg$currPos; -            if (input.substr(peg$currPos, 3) === peg$c53) { -              s1 = peg$c53; +            if (input.substr(peg$currPos, 3) === peg$c59) { +              s1 = peg$c59;                peg$currPos += 3;              } else {                s1 = peg$FAILED; -              if (peg$silentFails === 0) { peg$fail(peg$c54); } +              if (peg$silentFails === 0) { peg$fail(peg$c60); }              }              if (s1 !== peg$FAILED) {                s2 = []; @@ -917,7 +953,7 @@ module.exports = (function() {                  s3 = peg$parseStringLiteral();                  if (s3 !== peg$FAILED) {                    peg$savedPos = s0; -                  s1 = peg$c55(s3); +                  s1 = peg$c61(s3);                    s0 = s1;                  } else {                    peg$currPos = s0; @@ -933,12 +969,12 @@ module.exports = (function() {              }              if (s0 === peg$FAILED) {                s0 = peg$currPos; -              if (input.substr(peg$currPos, 3) === peg$c56) { -                s1 = peg$c56; +              if (input.substr(peg$currPos, 3) === peg$c62) { +                s1 = peg$c62;                  peg$currPos += 3;                } else {                  s1 = peg$FAILED; -                if (peg$silentFails === 0) { peg$fail(peg$c57); } +                if (peg$silentFails === 0) { peg$fail(peg$c63); }                }                if (s1 !== peg$FAILED) {                  s2 = []; @@ -955,7 +991,7 @@ module.exports = (function() {                    s3 = peg$parseStringLiteral();                    if (s3 !== peg$FAILED) {                      peg$savedPos = s0; -                    s1 = peg$c58(s3); +                    s1 = peg$c64(s3);                      s0 = s1;                    } else {                      peg$currPos = s0; @@ -971,12 +1007,12 @@ module.exports = (function() {                }                if (s0 === peg$FAILED) {                  s0 = peg$currPos; -                if (input.substr(peg$currPos, 2) === peg$c59) { -                  s1 = peg$c59; +                if (input.substr(peg$currPos, 2) === peg$c65) { +                  s1 = peg$c65;                    peg$currPos += 2;                  } else {                    s1 = peg$FAILED; -                  if (peg$silentFails === 0) { peg$fail(peg$c60); } +                  if (peg$silentFails === 0) { peg$fail(peg$c66); }                  }                  if (s1 !== peg$FAILED) {                    s2 = []; @@ -993,7 +1029,7 @@ module.exports = (function() {                      s3 = peg$parseStringLiteral();                      if (s3 !== peg$FAILED) {                        peg$savedPos = s0; -                      s1 = peg$c61(s3); +                      s1 = peg$c67(s3);                        s0 = s1;                      } else {                        peg$currPos = s0; @@ -1009,12 +1045,12 @@ module.exports = (function() {                  }                  if (s0 === peg$FAILED) {                    s0 = peg$currPos; -                  if (input.substr(peg$currPos, 2) === peg$c62) { -                    s1 = peg$c62; +                  if (input.substr(peg$currPos, 2) === peg$c68) { +                    s1 = peg$c68;                      peg$currPos += 2;                    } else {                      s1 = peg$FAILED; -                    if (peg$silentFails === 0) { peg$fail(peg$c63); } +                    if (peg$silentFails === 0) { peg$fail(peg$c69); }                    }                    if (s1 !== peg$FAILED) {                      s2 = []; @@ -1031,7 +1067,7 @@ module.exports = (function() {                        s3 = peg$parseStringLiteral();                        if (s3 !== peg$FAILED) {                          peg$savedPos = s0; -                        s1 = peg$c64(s3); +                        s1 = peg$c70(s3);                          s0 = s1;                        } else {                          peg$currPos = s0; @@ -1047,12 +1083,12 @@ module.exports = (function() {                    }                    if (s0 === peg$FAILED) {                      s0 = peg$currPos; -                    if (input.substr(peg$currPos, 3) === peg$c65) { -                      s1 = peg$c65; +                    if (input.substr(peg$currPos, 3) === peg$c71) { +                      s1 = peg$c71;                        peg$currPos += 3;                      } else {                        s1 = peg$FAILED; -                      if (peg$silentFails === 0) { peg$fail(peg$c66); } +                      if (peg$silentFails === 0) { peg$fail(peg$c72); }                      }                      if (s1 !== peg$FAILED) {                        s2 = []; @@ -1069,7 +1105,7 @@ module.exports = (function() {                          s3 = peg$parseStringLiteral();                          if (s3 !== peg$FAILED) {                            peg$savedPos = s0; -                          s1 = peg$c67(s3); +                          s1 = peg$c73(s3);                            s0 = s1;                          } else {                            peg$currPos = s0; @@ -1085,12 +1121,12 @@ module.exports = (function() {                      }                      if (s0 === peg$FAILED) {                        s0 = peg$currPos; -                      if (input.substr(peg$currPos, 3) === peg$c68) { -                        s1 = peg$c68; +                      if (input.substr(peg$currPos, 3) === peg$c74) { +                        s1 = peg$c74;                          peg$currPos += 3;                        } else {                          s1 = peg$FAILED; -                        if (peg$silentFails === 0) { peg$fail(peg$c69); } +                        if (peg$silentFails === 0) { peg$fail(peg$c75); }                        }                        if (s1 !== peg$FAILED) {                          s2 = []; @@ -1107,7 +1143,7 @@ module.exports = (function() {                            s3 = peg$parseStringLiteral();                            if (s3 !== peg$FAILED) {                              peg$savedPos = s0; -                            s1 = peg$c70(s3); +                            s1 = peg$c76(s3);                              s0 = s1;                            } else {                              peg$currPos = s0; @@ -1123,12 +1159,12 @@ module.exports = (function() {                        }                        if (s0 === peg$FAILED) {                          s0 = peg$currPos; -                        if (input.substr(peg$currPos, 2) === peg$c71) { -                          s1 = peg$c71; +                        if (input.substr(peg$currPos, 2) === peg$c77) { +                          s1 = peg$c77;                            peg$currPos += 2;                          } else {                            s1 = peg$FAILED; -                          if (peg$silentFails === 0) { peg$fail(peg$c72); } +                          if (peg$silentFails === 0) { peg$fail(peg$c78); }                          }                          if (s1 !== peg$FAILED) {                            s2 = []; @@ -1145,7 +1181,7 @@ module.exports = (function() {                              s3 = peg$parseStringLiteral();                              if (s3 !== peg$FAILED) {                                peg$savedPos = s0; -                              s1 = peg$c73(s3); +                              s1 = peg$c79(s3);                                s0 = s1;                              } else {                                peg$currPos = s0; @@ -1164,7 +1200,7 @@ module.exports = (function() {                            s1 = peg$parseStringLiteral();                            if (s1 !== peg$FAILED) {                              peg$savedPos = s0; -                            s1 = peg$c73(s1); +                            s1 = peg$c79(s1);                            }                            s0 = s1;                          } @@ -1186,53 +1222,53 @@ module.exports = (function() {        peg$silentFails++;        s0 = peg$currPos; -      if (peg$c75.test(input.charAt(peg$currPos))) { +      if (peg$c81.test(input.charAt(peg$currPos))) {          s1 = input.charAt(peg$currPos);          peg$currPos++;        } else {          s1 = peg$FAILED; -        if (peg$silentFails === 0) { peg$fail(peg$c76); } +        if (peg$silentFails === 0) { peg$fail(peg$c82); }        }        if (s1 === peg$FAILED) {          s1 = null;        }        if (s1 !== peg$FAILED) {          s2 = []; -        if (peg$c77.test(input.charAt(peg$currPos))) { +        if (peg$c83.test(input.charAt(peg$currPos))) {            s3 = input.charAt(peg$currPos);            peg$currPos++;          } else {            s3 = peg$FAILED; -          if (peg$silentFails === 0) { peg$fail(peg$c78); } +          if (peg$silentFails === 0) { peg$fail(peg$c84); }          }          if (s3 !== peg$FAILED) {            while (s3 !== peg$FAILED) {              s2.push(s3); -            if (peg$c77.test(input.charAt(peg$currPos))) { +            if (peg$c83.test(input.charAt(peg$currPos))) {                s3 = input.charAt(peg$currPos);                peg$currPos++;              } else {                s3 = peg$FAILED; -              if (peg$silentFails === 0) { peg$fail(peg$c78); } +              if (peg$silentFails === 0) { peg$fail(peg$c84); }              }            }          } else {            s2 = peg$FAILED;          }          if (s2 !== peg$FAILED) { -          if (peg$c75.test(input.charAt(peg$currPos))) { +          if (peg$c81.test(input.charAt(peg$currPos))) {              s3 = input.charAt(peg$currPos);              peg$currPos++;            } else {              s3 = peg$FAILED; -            if (peg$silentFails === 0) { peg$fail(peg$c76); } +            if (peg$silentFails === 0) { peg$fail(peg$c82); }            }            if (s3 === peg$FAILED) {              s3 = null;            }            if (s3 !== peg$FAILED) {              peg$savedPos = s0; -            s1 = peg$c79(s2); +            s1 = peg$c85(s2);              s0 = s1;            } else {              peg$currPos = s0; @@ -1249,7 +1285,7 @@ module.exports = (function() {        peg$silentFails--;        if (s0 === peg$FAILED) {          s1 = peg$FAILED; -        if (peg$silentFails === 0) { peg$fail(peg$c74); } +        if (peg$silentFails === 0) { peg$fail(peg$c80); }        }        return s0; @@ -1261,11 +1297,11 @@ module.exports = (function() {        peg$silentFails++;        s0 = peg$currPos;        if (input.charCodeAt(peg$currPos) === 34) { -        s1 = peg$c81; +        s1 = peg$c87;          peg$currPos++;        } else {          s1 = peg$FAILED; -        if (peg$silentFails === 0) { peg$fail(peg$c82); } +        if (peg$silentFails === 0) { peg$fail(peg$c88); }        }        if (s1 !== peg$FAILED) {          s2 = []; @@ -1276,15 +1312,15 @@ module.exports = (function() {          }          if (s2 !== peg$FAILED) {            if (input.charCodeAt(peg$currPos) === 34) { -            s3 = peg$c81; +            s3 = peg$c87;              peg$currPos++;            } else {              s3 = peg$FAILED; -            if (peg$silentFails === 0) { peg$fail(peg$c82); } +            if (peg$silentFails === 0) { peg$fail(peg$c88); }            }            if (s3 !== peg$FAILED) {              peg$savedPos = s0; -            s1 = peg$c83(s2); +            s1 = peg$c89(s2);              s0 = s1;            } else {              peg$currPos = s0; @@ -1301,11 +1337,11 @@ module.exports = (function() {        if (s0 === peg$FAILED) {          s0 = peg$currPos;          if (input.charCodeAt(peg$currPos) === 39) { -          s1 = peg$c84; +          s1 = peg$c90;            peg$currPos++;          } else {            s1 = peg$FAILED; -          if (peg$silentFails === 0) { peg$fail(peg$c85); } +          if (peg$silentFails === 0) { peg$fail(peg$c91); }          }          if (s1 !== peg$FAILED) {            s2 = []; @@ -1316,15 +1352,15 @@ module.exports = (function() {            }            if (s2 !== peg$FAILED) {              if (input.charCodeAt(peg$currPos) === 39) { -              s3 = peg$c84; +              s3 = peg$c90;                peg$currPos++;              } else {                s3 = peg$FAILED; -              if (peg$silentFails === 0) { peg$fail(peg$c85); } +              if (peg$silentFails === 0) { peg$fail(peg$c91); }              }              if (s3 !== peg$FAILED) {                peg$savedPos = s0; -              s1 = peg$c83(s2); +              s1 = peg$c89(s2);                s0 = s1;              } else {                peg$currPos = s0; @@ -1363,7 +1399,7 @@ module.exports = (function() {              }              if (s2 !== peg$FAILED) {                peg$savedPos = s0; -              s1 = peg$c83(s2); +              s1 = peg$c89(s2);                s0 = s1;              } else {                peg$currPos = s0; @@ -1378,7 +1414,7 @@ module.exports = (function() {        peg$silentFails--;        if (s0 === peg$FAILED) {          s1 = peg$FAILED; -        if (peg$silentFails === 0) { peg$fail(peg$c80); } +        if (peg$silentFails === 0) { peg$fail(peg$c86); }        }        return s0; @@ -1390,12 +1426,12 @@ module.exports = (function() {        s0 = peg$currPos;        s1 = peg$currPos;        peg$silentFails++; -      if (peg$c86.test(input.charAt(peg$currPos))) { +      if (peg$c92.test(input.charAt(peg$currPos))) {          s2 = input.charAt(peg$currPos);          peg$currPos++;        } else {          s2 = peg$FAILED; -        if (peg$silentFails === 0) { peg$fail(peg$c87); } +        if (peg$silentFails === 0) { peg$fail(peg$c93); }        }        peg$silentFails--;        if (s2 === peg$FAILED) { @@ -1410,11 +1446,11 @@ module.exports = (function() {            peg$currPos++;          } else {            s2 = peg$FAILED; -          if (peg$silentFails === 0) { peg$fail(peg$c88); } +          if (peg$silentFails === 0) { peg$fail(peg$c94); }          }          if (s2 !== peg$FAILED) {            peg$savedPos = s0; -          s1 = peg$c89(s2); +          s1 = peg$c95(s2);            s0 = s1;          } else {            peg$currPos = s0; @@ -1427,17 +1463,17 @@ module.exports = (function() {        if (s0 === peg$FAILED) {          s0 = peg$currPos;          if (input.charCodeAt(peg$currPos) === 92) { -          s1 = peg$c90; +          s1 = peg$c96;            peg$currPos++;          } else {            s1 = peg$FAILED; -          if (peg$silentFails === 0) { peg$fail(peg$c91); } +          if (peg$silentFails === 0) { peg$fail(peg$c97); }          }          if (s1 !== peg$FAILED) {            s2 = peg$parseEscapeSequence();            if (s2 !== peg$FAILED) {              peg$savedPos = s0; -            s1 = peg$c89(s2); +            s1 = peg$c95(s2);              s0 = s1;            } else {              peg$currPos = s0; @@ -1458,12 +1494,12 @@ module.exports = (function() {        s0 = peg$currPos;        s1 = peg$currPos;        peg$silentFails++; -      if (peg$c92.test(input.charAt(peg$currPos))) { +      if (peg$c98.test(input.charAt(peg$currPos))) {          s2 = input.charAt(peg$currPos);          peg$currPos++;        } else {          s2 = peg$FAILED; -        if (peg$silentFails === 0) { peg$fail(peg$c93); } +        if (peg$silentFails === 0) { peg$fail(peg$c99); }        }        peg$silentFails--;        if (s2 === peg$FAILED) { @@ -1478,11 +1514,11 @@ module.exports = (function() {            peg$currPos++;          } else {            s2 = peg$FAILED; -          if (peg$silentFails === 0) { peg$fail(peg$c88); } +          if (peg$silentFails === 0) { peg$fail(peg$c94); }          }          if (s2 !== peg$FAILED) {            peg$savedPos = s0; -          s1 = peg$c89(s2); +          s1 = peg$c95(s2);            s0 = s1;          } else {            peg$currPos = s0; @@ -1495,17 +1531,17 @@ module.exports = (function() {        if (s0 === peg$FAILED) {          s0 = peg$currPos;          if (input.charCodeAt(peg$currPos) === 92) { -          s1 = peg$c90; +          s1 = peg$c96;            peg$currPos++;          } else {            s1 = peg$FAILED; -          if (peg$silentFails === 0) { peg$fail(peg$c91); } +          if (peg$silentFails === 0) { peg$fail(peg$c97); }          }          if (s1 !== peg$FAILED) {            s2 = peg$parseEscapeSequence();            if (s2 !== peg$FAILED) {              peg$savedPos = s0; -            s1 = peg$c89(s2); +            s1 = peg$c95(s2);              s0 = s1;            } else {              peg$currPos = s0; @@ -1540,11 +1576,11 @@ module.exports = (function() {            peg$currPos++;          } else {            s2 = peg$FAILED; -          if (peg$silentFails === 0) { peg$fail(peg$c88); } +          if (peg$silentFails === 0) { peg$fail(peg$c94); }          }          if (s2 !== peg$FAILED) {            peg$savedPos = s0; -          s1 = peg$c89(s2); +          s1 = peg$c95(s2);            s0 = s1;          } else {            peg$currPos = s0; @@ -1561,53 +1597,53 @@ module.exports = (function() {      function peg$parseEscapeSequence() {        var s0, s1; -      if (peg$c94.test(input.charAt(peg$currPos))) { +      if (peg$c100.test(input.charAt(peg$currPos))) {          s0 = input.charAt(peg$currPos);          peg$currPos++;        } else {          s0 = peg$FAILED; -        if (peg$silentFails === 0) { peg$fail(peg$c95); } +        if (peg$silentFails === 0) { peg$fail(peg$c101); }        }        if (s0 === peg$FAILED) {          s0 = peg$currPos;          if (input.charCodeAt(peg$currPos) === 110) { -          s1 = peg$c96; +          s1 = peg$c102;            peg$currPos++;          } else {            s1 = peg$FAILED; -          if (peg$silentFails === 0) { peg$fail(peg$c97); } +          if (peg$silentFails === 0) { peg$fail(peg$c103); }          }          if (s1 !== peg$FAILED) {            peg$savedPos = s0; -          s1 = peg$c98(); +          s1 = peg$c104();          }          s0 = s1;          if (s0 === peg$FAILED) {            s0 = peg$currPos;            if (input.charCodeAt(peg$currPos) === 114) { -            s1 = peg$c99; +            s1 = peg$c105;              peg$currPos++;            } else {              s1 = peg$FAILED; -            if (peg$silentFails === 0) { peg$fail(peg$c100); } +            if (peg$silentFails === 0) { peg$fail(peg$c106); }            }            if (s1 !== peg$FAILED) {              peg$savedPos = s0; -            s1 = peg$c101(); +            s1 = peg$c107();            }            s0 = s1;            if (s0 === peg$FAILED) {              s0 = peg$currPos;              if (input.charCodeAt(peg$currPos) === 116) { -              s1 = peg$c102; +              s1 = peg$c108;                peg$currPos++;              } else {                s1 = peg$FAILED; -              if (peg$silentFails === 0) { peg$fail(peg$c103); } +              if (peg$silentFails === 0) { peg$fail(peg$c109); }              }              if (s1 !== peg$FAILED) {                peg$savedPos = s0; -              s1 = peg$c104(); +              s1 = peg$c110();              }              s0 = s1;            } @@ -1726,6 +1762,10 @@ module.exports = (function() {          responseHeaderFilter.desc = "resp. header matches " + regex;          return responseHeaderFilter;      } +    function httpFilter(flow){ +        return flow.type === "http"; +    } +    httpFilter.desc = "is an HTTP Flow";      function method(regex){          regex = new RegExp(regex, "i");          function methodFilter(flow){ @@ -1759,6 +1799,10 @@ module.exports = (function() {          contentTypeFilter.desc = "content type matches " + regex;          return contentTypeFilter;      } +    function tcpFilter(flow){ +        return flow.type === "tcp"; +    } +    tcpFilter.desc = "is a TCP Flow";      function requestContentType(regex){          regex = new RegExp(regex, "i");          function requestContentTypeFilter(flow){ diff --git a/web/src/js/filt/filt.peg b/web/src/js/filt/filt.peg index 352b1337..f3235ccd 100644 --- a/web/src/js/filt/filt.peg +++ b/web/src/js/filt/filt.peg @@ -109,6 +109,10 @@ function responseHeader(regex){      responseHeaderFilter.desc = "resp. header matches " + regex;      return responseHeaderFilter;  } +function httpFilter(flow){ +    return flow.type === "http"; +} +httpFilter.desc = "is an HTTP Flow";  function method(regex){      regex = new RegExp(regex, "i");      function methodFilter(flow){ @@ -142,6 +146,10 @@ function contentType(regex){      contentTypeFilter.desc = "content type matches " + regex;      return contentTypeFilter;  } +function tcpFilter(flow){ +    return flow.type === "tcp"; +} +tcpFilter.desc = "is a TCP Flow";  function requestContentType(regex){      regex = new RegExp(regex, "i");      function requestContentTypeFilter(flow){ @@ -205,9 +213,11 @@ NullaryExpr    = BooleanLiteral    / "~a" { return assetFilter; }    / "~e" { return errorFilter; } +  / "~http" { return httpFilter; } +  / "~marked" { return markedFilter; }    / "~q" { return noResponseFilter; }    / "~s" { return responseFilter; } -  / "~marked" { return markedFilter; } +  / "~tcp" { return tcpFilter; }  BooleanLiteral | 
