diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2016-02-16 20:34:14 +0100 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2016-02-16 20:37:53 +0100 |
commit | dedca540996f337f3965fb87531fd03d7e27e417 (patch) | |
tree | 26fd182cd12d3c561f2a6baa9db992ffd1080040 /pathod/libpathod/protocols/websockets.py | |
parent | ef8e95956d938fd4891d79fdbfa83f8a77a482cb (diff) | |
download | mitmproxy-dedca540996f337f3965fb87531fd03d7e27e417.tar.gz mitmproxy-dedca540996f337f3965fb87531fd03d7e27e417.tar.bz2 mitmproxy-dedca540996f337f3965fb87531fd03d7e27e417.zip |
rename pathod source directory
Diffstat (limited to 'pathod/libpathod/protocols/websockets.py')
-rw-r--r-- | pathod/libpathod/protocols/websockets.py | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/pathod/libpathod/protocols/websockets.py b/pathod/libpathod/protocols/websockets.py deleted file mode 100644 index 134d27bc..00000000 --- a/pathod/libpathod/protocols/websockets.py +++ /dev/null @@ -1,56 +0,0 @@ -import time - -from netlib import websockets -from .. import language -from netlib.exceptions import NetlibException - - -class WebsocketsProtocol: - - def __init__(self, pathod_handler): - self.pathod_handler = pathod_handler - - def handle_websocket(self, logger): - while True: - with logger.ctx() as lg: - started = time.time() - try: - frm = websockets.Frame.from_file(self.pathod_handler.rfile) - except NetlibException as e: - lg("Error reading websocket frame: %s" % e) - break - ended = time.time() - lg(frm.human_readable()) - retlog = dict( - type="inbound", - protocol="websockets", - started=started, - duration=ended - started, - frame=dict( - ), - cipher=None, - ) - if self.pathod_handler.ssl_established: - retlog["cipher"] = self.pathod_handler.get_current_cipher() - self.pathod_handler.addlog(retlog) - ld = language.websockets.NESTED_LEADER - if frm.payload.startswith(ld): - nest = frm.payload[len(ld):] - try: - wf_gen = language.parse_websocket_frame(nest) - except language.exceptions.ParseException as v: - logger.write( - "Parse error in reflected frame specifcation:" - " %s" % v.msg - ) - return None, None - for frm in wf_gen: - with logger.ctx() as lg: - frame_log = language.serve( - frm, - self.pathod_handler.wfile, - self.pathod_handler.settings - ) - lg("crafting websocket spec: %s" % frame_log["spec"]) - self.pathod_handler.addlog(frame_log) - return self.handle_websocket, None |