MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / _Masked

Class _Masked

test/mitmproxy/proxy/layers/test_websocket.py:29–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28@dataclass
29class _Masked:
30 unmasked: bytes
31
32 def __eq__(self, other):
33 other = bytearray(other)
34 assert other[1] & 0b1000_0000 # assert this is actually masked
35 other[1] &= 0b0111_1111 # remove mask bit
36 assert other[1] < 126 # (we don't support extended payload length here)
37 mask = other[2:6]
38 payload = bytes(x ^ mask[i % 4] for i, x in enumerate(other[6:]))
39 return self.unmasked == other[:2] + payload
40
41
42# noinspection PyTypeChecker

Callers 1

maskedFunction · 0.85

Calls

no outgoing calls

Tested by 1

maskedFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…