wscat
is a command-line tool that acts as a WebSocket client, similar to the cat
command but for WebSocket connections. It allows you to send data from standard input to a WebSocket server and receive data from the server to standard output.
- Supports WebSocket (
ws
) and secure WebSocket (wss
) connections. - Supports HTTP and HTTPS proxies.
- Supports custom WebSocket protocol names.
- Supports buffer size configuration.
- Supports connection and DNS timeout configuration.
- Supports deflate compression.
- Supports ignoring invalid SSL certificates.
libcurl
with WebSocket support.
-
Install the required dependencies:
sudo apt-get update sudo apt-get install build-essential libcurl4-openssl-dev
-
Clone the repository:
git clone https://github.com/yourusername/wscat.git cd wscat
-
Compile the
wscat
tool:gcc -o wscat wscat.c -lcurl
-
Install the required dependencies using Homebrew:
brew install curl
-
Clone the repository:
git clone https://github.com/yourusername/wscat.git cd wscat
-
Compile the
wscat
tool:gcc -o wscat wscat.c -lcurl
./wscat [options] <WebSocket URL>
--protocol <protocol name>
: Set the WebSocket protocol name (default:wscat-protocol
).--buffer-size <buffer size>
: Set the buffer size (default:1024
).--timeout <timeout>
: Set the connection timeout in seconds (default:60
).--dns-timeout <dns timeout>
: Set the DNS resolution timeout in seconds (default:30
).--deflate
: Enable deflate compression.--insecure
: Ignore invalid SSL certificates.
-
Connect to a WebSocket server with default settings:
./wscat ws://echo.example.site
-
Connect to a WebSocket server with a custom protocol name and buffer size:
./wscat --protocol my-protocol --buffer-size 2048 ws://echo.example.site
-
Connect to a WebSocket server with a connection timeout and DNS timeout:
./wscat --timeout 60 --dns-timeout 30 ws://echo.example.site
-
Connect to a WebSocket server with deflate compression enabled:
./wscat --deflate ws://echo.example.site
-
Connect to a WebSocket server and ignore invalid SSL certificates:
./wscat --insecure wss://echo.example.site
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request.
libcurl
for providing the WebSocket support.