import time from mitmproxy.net import websockets from pathod import language from mitmproxy import exceptions 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 exceptions.NetlibException as e: lg("Error reading websocket frame: %s" % e) return None, None ended = time.time() lg(repr(frm)) retlog = dict( type="inbound", protocol="websockets", started=started, duration=ended - started, frame=dict( ), cipher=None, ) if self.pathod_handler.tls_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.decode()) 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) nwrt/upstream/tree/target/linux/ramips/dts/DIR-620-D1.dts?h=upstream&id=77b807999d86498c4378a136bd366d09eb2c9bd5'>treecommitdiffstats
path: root/target/linux/ramips/dts/DIR-620-D1.dts
blob: 5cf330e66bbec23e96c35ae3a2e1f77a3e1fba80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110