diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2015-06-04 23:57:23 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2015-06-04 23:57:23 +1200 |
commit | 0a7da6a9b1b878cbfabf437759031f816161fab7 (patch) | |
tree | b287c636e98a5ba850c8a3da0c44a06e3d0a53a1 /libpathod/language/websockets.py | |
parent | 9311d605964a346e9a51bc841bfcdf5d38e392a1 (diff) | |
download | mitmproxy-0a7da6a9b1b878cbfabf437759031f816161fab7.tar.gz mitmproxy-0a7da6a9b1b878cbfabf437759031f816161fab7.tar.bz2 mitmproxy-0a7da6a9b1b878cbfabf437759031f816161fab7.zip |
Rudimentary support for reflected websocket frames.
Diffstat (limited to 'libpathod/language/websockets.py')
-rw-r--r-- | libpathod/language/websockets.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libpathod/language/websockets.py b/libpathod/language/websockets.py index 44c12f64..96dbce53 100644 --- a/libpathod/language/websockets.py +++ b/libpathod/language/websockets.py @@ -3,6 +3,7 @@ import netlib.websockets import pyparsing as pp from . import base, generators, actions, message +NESTED_LEADER = "pathod!" class WF(base.CaselessLiteral): TOK = "wf" @@ -160,6 +161,10 @@ class WebsocketFrame(message.Message): resp = resp.setParseAction(klass) return resp + @property + def nested_frame(self): + return self.tok(NestedFrame) + def resolve(self, settings, msg=None): tokens = self.tokens[:] if not self.mask and settings.is_client: @@ -181,6 +186,9 @@ class WebsocketFrame(message.Message): elif self.rawbody: bodygen = self.rawbody.value.get_generator(settings) length = len(self.rawbody.value.get_generator(settings)) + elif self.nested_frame: + bodygen = NESTED_LEADER + self.nested_frame.parsed.spec() + length = len(bodygen) else: bodygen = None length = 0 @@ -228,7 +236,3 @@ class WebsocketClientFrame(WebsocketFrame): components = COMPONENTS + ( NestedFrame, ) - - @property - def nested_frame(self): - return self.tok(NestedFrame) |