vi / websocat

Command-line client for WebSockets, like netcat (or curl) for ws:// with advanced socat-like functions
MIT License
6.74k stars 261 forks source link

wss MITM proxy #87

Open Foster024 opened 3 years ago

Foster024 commented 3 years ago

Hey. Please help me with the launch parameters of the program. I want to use websocat for programs running locally on my computer, as a proxy server for https-wss on the global Internet. 1) I want to see in the console the contents of packets that pass through the proxy server 2) I want to pass data from websocat to another package editing program. I want to use tcp ip connection or read / write to local file. This is needed to carry out an attack like MITM.

vi commented 3 years ago

It is likely cannot be done with just a simple launch parameters.

Although websocat can sort-of-forward one WebSocket connection into another (e.g. something like websocat ws-l:127.0.0.1:1234 ws://echo.websocket.org), it does not preserve many parameters and work only for one URL, making it a poor choice for a transparent proxy.

Inspecting packets as they pass though can probably be done with socat -v -x used in combination with a pair of Websocats (one for server, one for client).

If you need more reliable solution, you'll probably need to enhance support of WebSockets in mitmproxy or something like that.

Foster024 commented 3 years ago

websocat -t ws-l:127.0.0.1:1234 reuse-raw:- | websocat ws://echo.websocket.org -vv Why i can't see response in client window after connect 127.0.0.1:1234? I see response in "proxy-server" window.

PS: only 1 URL i need working

vi commented 3 years ago

The | pipe between the two websocats is unidirectional.

You need to combine Websocats in a bidirectional way for this to work.

For example:

websocat -E -t ws-l:127.0.0.1:1234 reuse-raw:exec:websocat --exec-args ws://echo.websocket.org -vv