Capture WebSocket packets using man-in-the-middle

The handler is being removed because the TCP connection appears to be being torn down immediately, at least based on the error log. If you update NTWebSocketFrameHandler to log channelInactive you should be seeing that before handlerRemoved. In this case, handlerRemoved is being invoked because the connection is being torn down.

Hi, lukasa, I have got WebSocket binary data, but how to decrypt it?
Logs:

frame.opcode : WebSocketOpcode.binary
frame : WebSocketFrame(_storage: NIOWebSocket.WebSocketFrame.(unknown context at $102a33b60)._Storage, maskKey: Optional(NIOWebSocket.WebSocketMaskingKey(_key: (8, 103, 141, 86))), firstByte: 130)

You can access the data directly as frame.unmaskedData.

Thanks, kukasa.

when I print frame.unmaskedData, there is a lot of garble in it.

How could I fix it?

That garble suggests that there's binary data contained within the frame. Can I suggest loading that data into an Array and then attempting to inspect it?

1 Like

Got it. Thank you very much!

1 Like

Hi, Lukasa, Does SwiftNIO support TLS 1.3 ?

Yes.

Terms of Service

Privacy Policy

Cookie Policy