WebSocket cat

Related tags

WebSocket wscat
Overview

wscat

WebSocket cat.

Installation

This module needs to be installed globally so use the -g flag when installing:

npm install -g wscat

Usage

Usage: wscat [options] (--listen 
   
     | --connect 
    
     )

Options:
  -V, --version                       output the version number
  -l, --listen 
     
                       listen on port
  -c, --connect 
      
                        connect to a WebSocket server
  -p, --protocol 
       
         optional protocol version -o, --origin 
        
          optional origin -x, --execute 
          execute command after connecting -w, --wait 
         
           wait given seconds after executing command -P, --show-ping-pong print a notification when a ping or pong is received --host 
          
            optional host -s, --subprotocol 
           
             optional subprotocol (default: []) -n, --no-check do not check for unauthorized certificates -H, --header 
            
              set an HTTP header. Repeat to set multiple (--connect only) (default: []) --auth 
             
               add basic HTTP authentication header (--connect only) --ca 
              
                specify a Certificate Authority (--connect only) --cert 
               
                 specify a Client SSL Certificate (--connect only) --key 
                
                  specify a Client SSL Certificate's key (--connect only) --passphrase [passphrase] specify a Client SSL Certificate Key's passphrase (--connect only). If you don't provide a value, it will be prompted for --no-color run without color --slash enable slash commands for control frames (/ping, /pong, /close [code [, reason]]) --proxy <[protocol://]host[:port]> connect via a proxy. Proxy must support CONNECT method -h, --help output usage information 
                
               
              
             
            
           
          
         
        
       
      
     
    
   

Example

$ wscat -c ws://echo.websocket.org
Connected (press CTRL+C to quit)
> hi there
< hi there
> are you a happy parrot?
< are you a happy parrot?

License

MIT

Comments
  • release 2.0.0

    release 2.0.0

    @lpinca, @3rd-Eden, @einaros... I don't have access on npm to publish this package, but I made some changes that will fix a few issues. Can you please release 1.2.0 or give me access to?

    opened by nwwells 8
  • WSS Compatibility

    WSS Compatibility

    Hi im trying to connect like this : wscat -c wss://webgistesting.snig.gub.uy:8734/WebSocketsServer -p 13

    However get this error: error: Error: unable to verify the first certificate

    opened by fcabrera23 7
  • [minor] added --print-reason cli argument for ws close reason

    [minor] added --print-reason cli argument for ws close reason

    intended to solve https://github.com/websockets/wscat/issues/108

    functionality

    when using -r or --print-reason, when the ws closes and the server sends a reason string, the console will exit with Disconnected (code: 4001, reason: some reason) instead of the current Disconnected (code: 4001).

    This is opt-in, to keep the change minor.

    display considerations

    Maybe we want to give even more space to the reason, and bring it in its own line, without wrapping it in brackets, as the server might send a multi-line reason

    implementation considerations

    I've implemented this as a method of wsConsole to avoid code duplication, but it doesn't feel like it would belong there. Having a helper function to do this would need to have wsConsole passed to it, as the disconnect message is sent in two places that reference different wsConsoles. I tend to avoid f(obj, ..params) when almost everywhere obj.f(...params) is used. I'll leave this up for discussion.

    security considerations

    Currently reason is simply injected into the string to print, it's not sanitized by me. At best this means the server can change colors or ring bells in your terminal when the ws closes, at worst it could open the user up to remote code execution, depending on their terminal.

    Maybe this is fine, as wscat is mostly a debugging tool for APIs that you don't tend to consider malign. If it's not, I don't have in mind a best strategy to sanitize for all terminals other than only keeping ascii printable characters, or JSON.stringifying the whole string

    opened by towc 5
  • Update ws to the latest version 🚀

    Update ws to the latest version 🚀

    Version 2.0.0 of ws just got published.

    Dependency ws
    Current Version 1.1.1
    Type dependency

    The version 2.0.0 is not covered by your current version range.

    Without accepting this pull request your project will work just like it did before. There might be a bunch of new features, fixes and perf improvements that the maintainers worked on for you though.

    I recommend you look into these changes and try to get onto the latest version of ws. Given that you have a decent test suite, a passing build is a strong indicator that you can take advantage of these changes by merging the proposed change into your project. Otherwise this branch is a great starting point for you to work on the update.


    Release Notes 2.0.0

    Breaking changes

    • Dropped support for Node.js < 4.
    • The new operator is now required to create all instances as we moved to ES6 classes.
    • Error messages have been simplified.
    • The clients property of the WebSocketServer is no longer an Array but a Set and is only set if the clientTracking option is truthy (#806).
    • The default HTTP status message is now used when handshake fails (41e7cae).
    • Removed support for the Hixie-76 version of the protocol (#871).
    • Removed ability to specify different paths for multiple WebSocketServers when binding them to the same underlying HTTP/s server (#885).
    • Removed WebSocket.prototype.stream() and ability to pass a readable stream to WebSocket.prototype.send() (#875).
    • Removed callback argument from handleProtocols handler (#890).
    • Removed supports property from WebSocket (#918).
    • Removed WebSocket.createServer(), WebSocket.createConnection(), and WebSocket.connect() factory functions (#926).
    • The second argument of WebSocket.prototype.ping() and WebSocket.prototype.pong() is no longer an options object but a boolean (#951).
    • An error is emitted if WebSocket.prototype.close() is called before the connection is established (#956).

    The following breaking changes only apply if you required the mentioned classes
    directly.

    • Removed Sender inheritance from EventEmitter (#861).
    • Removed BufferPool class (73ab370).
    • Made extensions a required argument for the Receiver constructor (5f53194).
    • receiver.onbinary and receiver.ontext have been merged into receiver.onmessage (#939).

    Features

    • Added ability to set TCP backlog for WebSocketServer (#795).
    • Added checkServerIdentity option to WebSocket (#701).
    • Added a threshold option for permessage-deflate to only compress messages whose size is bigger than threshold (6b3904b).
    • Added shouldHandle method to WebSocketServer to see if a request should be accepted or rejected. This method can be overridden by the user if a custom logic is desired (6472425).
    • Added removeEventListener method to WebSocket (078e96a).
    • Added family option to WebSocket (#962).

    Bug fixes

    • Fixed an issue that prevented permessage-deflate options from being correctly handled (#744).
    • All error events are now emitted with a proper Error instance (#789).
    • Fixed an issue that could cause a stack overflow crash (#810).
    • Added 1012 and 1013 to the list of allowed close codes (b58f688).
    • Fixed an issue that prevented the connection from being closed when path validation failed (#534).
    • Fixed an issue where the fin option of WebSocket.prototype.send() was unconditionally set to true (ea50be7).
    • Fixed an issue that prevented the total length of a fragmented message from being correctly calculated (545635d).
    • Fixed an issue where zlib.flush() was called with a wrong flush level (#733).
    • The callback of WebSocketServer.prototype.close() is now invoked when the close event is emitted by the underlying HTTP/s server (#892).
    • Fixed an issue that prevented the server from listening on IPv6 addresses with default settings (dcdc652).
    • Fixed an issue where the connection event was emitted even if the client closed the connection during the handshake process (04530ad).
    • The masking key is now generated using crypto.randomBytes() instead of Math.random() (7253f06).
    • Fixed an issue that, under particular circumstances, caused data to be discarded (#945).
    • Fixed an issue that prevented clients from being removed from the clients set (#955).
    • WebSocket.prototype.close() now works as expected if called on the client before the connection is established (#956).
    • WebSocket.prototype.send() no longer mutates the options object (#968).
    • The bufferedAmount getter now takes into account the data queued in the sender (#971).
    Commits

    The new version differs by 266 commits (ahead by 266, behind by 2).

    • cb50a29 [dist] 2.0.0
    • 236ea22 [dist] 2.0.0-beta.2
    • d74a32e [fix] Take into account the data queued in the sender (#971)
    • bc35fa4 chore(package): update eslint to version 3.14.0 (#974)
    • 7fb84ba Merge pull request #965 from websockets/remove/outdated-link
    • 42f364e [doc] Remove outdated link and rephrase sentence accordingly
    • 24f0903 Merge pull request #966 from websockets/add/permessage-deflate-section
    • e62b9ba [dist] 2.0.0-beta.1
    • ac2dade [fix] Prevent WebSocket#close() from triggering an infinite loop (#969)
    • bd41a05 [fix] Use Object.assign() for send() options (#968)
    • 4d92092 [doc] Add WebSocket compression section
    • 7bec220 [doc] Modernize examples
    • fd910f1 [feature] Accept hostname lookup family option (#962)
    • 19ce183 [dist] 2.0.0-beta.0
    • 772a814 [fix] Abort the request if close is called while connecting (#956)

    There are 250 commits in total. See the full diff.

    Not sure how things should work exactly?

    There is a collection of frequently asked questions and of course you may always ask my humans.


    Your Greenkeeper Bot :palm_tree:

    greenkeeper 
    opened by greenkeeper[bot] 4
  • Process suspends itself right away

    Process suspends itself right away

    ➜  f git:(master) ✗ wscat -c wss://ws.foo.com/socket.io/?EIO=3&transport=websocket
    [2] 12476
    ➜  f git:(master) ✗
    [2]  + 12476 suspended (tty output)  wscat -c wss://ws.foo.com/socket.io/?EIO=3
    ➜  f git:(master) ✗ fg
    [2]  - 12476 continued  wscat -c wss://ws.foo.com/socket.io/?EIO=3
    error: Error: unexpected server response (502)
    > %
    
    opened by brandonros 4
  • Blue is too dark

    Blue is too dark

    I'm using wscat in a terminal with black background, and when blue is used, I can't see the text. In Vim, I can do set bg=dark to make the text colors lighter. There should be a way to change or disable the colors.

    opened by Ming-Tang 4
  • a problem about 'wscat' in windows

    a problem about 'wscat' in windows

    When using under ubuntu system, the command 'wscat -c ws://echo.websocket.org' running correct. But when using in git bash under windows 7(64 bits) system, it shows "events.js:72 throw er; // Unhandled 'error' event ". Why is this?

    opened by clearbug 4
  • [minor] added --hide-ping for hiding 'Received ping' and pong messages

    [minor] added --hide-ping for hiding 'Received ping' and pong messages

    intended to fix https://github.com/websockets/wscat/issues/107 and provide a workaround for https://github.com/websockets/wscat/issues/84

    functionality

    When using a -P or --hide-ping, the blue < Received ping (and pong) messages stop appearing in the console, which allows for a clean uninterrupted copy-pasteable transcript of the ws conversation.

    This is opt-in to keep the change minor. I would suggest to make this default in the next major version

    opened by towc 3
  • add proxy support to connect

    add proxy support to connect

    fixes #54

    Adds a new --proxy flag that will implement an https-proxy-agent and use the proxy specified.

    Used this to test if my proxy could handle WebSocket connections and worked like a charm. Thought I'd do a PR for this since there was some interest at some point.

    opened by enriquegh 3
  • wss with self signed cert not working

    wss with self signed cert not working

    wscat --key server.key.pem --cert server.pem -c wss://127.0.0.1:8080 results in

    (node:56311) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permitted by RFC 6066. This will be ignored in a future version. error: self signed certificate

    opened by SephVelut 3
  • Solved - Problem connecting with SocketCluster.io

    Solved - Problem connecting with SocketCluster.io

    Solved - connect to ws://localhost:xxxx/socketcluster/

    When attempting to connect to SocketCluster.io running on localhost, a 400 is returned. Example: wscat -c ws://127.0.0.1:8000 error: Error: unexpected server response (400)

    Not sure if this is a problem with wscat or SC!

    opened by MadGeometer 3
  • Support for binary response / hex output:

    Support for binary response / hex output:

    Before “ws.send(programOptions.execute);” add: ws.binaryType = "arraybuffer";

    For hex output use: wsConsole.print(Console.Types.Incoming, buf2hex(data), Console.Colors.Blue);

    p.s. function buf2hex(buffer) { // buffer is an ArrayBuffer return [...new Uint8Array(buffer)] .map(x => x.toString(16).padStart(2, '0')) .join(''); }

    opened by franky436 0
  • Not seeing response data

    Not seeing response data

    For example, on my $connect handler, I return

    { statusCode: 200, body: 'Connected' }
    

    But when I connect via wscat, I'm not seeing the body text in the terminal.

    opened by paul-uz 1
  • wscat returns nothing when launced from a cron @reboot

    wscat returns nothing when launced from a cron @reboot

    Hello,

    I want to notify the reboot of a raspberry pi to another server using wscat. I wrote this script:

    #!/bin/sh
    
    date >> reboot.log
    cmd="wscat -n -x reboot -c  wss://xxxxxxxxxxxxxxxx.com:18800/sub"
    
    OUTPUT=$($cmd)
    
    echo $OUTPUT
    while [ $OUTPUT != "ok" ]; do
      	sleep 30
    	OUTPUT=$($cmd)
    done
    
    

    --> it works well from command line with and without sudo. The server returns "ok" and the script stops before entering the loop.

    -->When launched from this cronjob : @reboot /home/pi/xxxxxxxx/rebootNotify.sh Nothing is returned from the wscat command, the script enters infinitly the loop (The loop exists in case unavailable network at reboot time. BTW, adding a sleep in the cron before calling the scripts leads to the same result). Where is the bug?

    note : wscat has been installed using sudo npm install -g wscat.

    Thanks Julien

    opened by JulienDevillers 2
  • Added support for multiline JSON parsing

    Added support for multiline JSON parsing

    It is pretty common to send JSON over websockets, and it can be rather limiting to be forced to "minify" the JSON string, especially for local testing. The new '-j --json' flag is supposed to alleviate that. The primary way this is alleviated is by allowing for multiline inputs. Secondarily, by leveraging the built in JSON.parse() method we can check to see if the inputs produce a valid JSON string, and determine that the multiline input is terminated. Finally, as inspired by the Scala REPL, two consecutive empty lines resets the input.

    Here are some samples of what this looks like while it is running:

    $ wscat -j -c ws://websocket-echo.com
    Connected (press CTRL+C to quit)
    > {}
    < {}
    > []
    < []
    > {
    |   "foo": "bar",
    |   "hello": "world"
    | }
    < {
      "foo": "bar",
      "hello": "world"
    }
    > 42
    < 42
    > "hello world"
    < "hello world"
    > [
    |   1,
    |   2
    |   ,3]
    < [
      1,
      2
      ,3]
    
    opened by DeiNile 0
  • Send Initial message into interactive shell.

    Send Initial message into interactive shell.

    I'd like to formulate a shell command that opens the wscat interact shell and also runs a given command right after it connects.

    Currently, if I send a payload with -x, it doesn't bring up the interactive shell.

    For example:

    > wscat -c <endpoint> -x "{Auth command}"
    
    Connected (press CTRL+C to quit)
    {AuthCommand}
    > 
    
    opened by davjhan 0
  • How to send null in wscat

    How to send null in wscat

    Is it possible to send null via wscat? I'm trying to debug a STOMP via WS connection and need to send null to finish the frame but the usual (ctrl+@ on linux) doesn't work.

    opened by s-spindler 0
Owner
WebSockets
WebSockets
A WebSocket Implementation for Node.JS (Draft -08 through the final RFC 6455)

WebSocket Client & Server Implementation for Node Overview This is a (mostly) pure JavaScript implementation of the WebSocket protocol versions 8 and

Brian McKelvey 3.6k Dec 30, 2022
WebSocket emulation - Node.js server

SockJS-node SockJS for enterprise Available as part of the Tidelift Subscription. The maintainers of SockJS and thousands of other packages are workin

SockJS 2.1k Dec 29, 2022
Simple to use, blazing fast and thoroughly tested WebSocket client and server for Node.js

ws: a Node.js WebSocket library ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and server implementation. Passes the quit

WebSockets 19.2k Jan 4, 2023
Standards-compliant WebSocket client and server

faye-websocket This is a general-purpose WebSocket implementation extracted from the Faye project. It provides classes for easily building WebSocket s

null 588 Dec 23, 2022
Lightweight WebSocket lib with socket.io-like event handling, requests, and channels

ws-wrapper Lightweight and isomorphic Web Socket lib with socket.io-like event handling, Promise-based requests, and channels. What? Much like Socket.

Blake Miner 70 Dec 23, 2022
The cutest little WebSocket wrapper! 🧦

Sockette The cutest little WebSocket wrapper! ?? Sockette is a tiny (367 bytes) wrapper around WebSocket that will automatically reconnect if the conn

Luke Edwards 2.4k Jan 2, 2023
A Develop Tool to Test WebSocket, Socket.IO, Stomp, Bayeux, HTTP, TCP, UDP, WebRTC, DNS API.

A Develop Tool to Test WebSocket, Socket.IO, Stomp, Bayeux, HTTP, TCP, UDP, WebRTC, DNS API.

York Yao 24 Sep 6, 2022
How to build a chat using Lambda + WebSocket + API Gateway? (nodejs)

Description Source code for the lambda function from the screencast How to build a chat using Lambda + WebSocket + API Gateway? (nodejs) The reactjs c

Alex 21 Dec 28, 2022
Mini Projeto de um chat-app usando o protocolo WebSocket através da lib 'ws' do node.js

CHAT-APP-WEBSOCKET Mini Projeto de um chat-app usando o protocolo WebSocket através da lib 'ws' do node.js Obs o intuito deste projeto não é o fronten

Vinicius dos Santos Rodrigues 4 Jul 14, 2022
A tiny Nuxt.js module for WebSocket interactions

@deepsource/nuxt-websocket A tiny Nuxt.js module for WebSocket interactions. This module is only compatible with Nuxt v2 at the moment. Setup Add @dee

DeepSource 23 Dec 6, 2022
A websocket-based reverse shell for XSS attacks.

CrossSiteShell A javascript/nodejs "reverse shell" that makes it easier to interact with the victim's browser during XSS attacks. Usage Run the follow

Rafael 13 Oct 7, 2022
Um bot feito utilizando a API baileys em WebSocket para o Whatsapp Multi-Devices.

Informação ?? O BaileysBot foi feito utilzando a API Baileys Caso encontre algum BUG, faça um Novo Issue! Requisitos ?? NodeJS Git Instalação ?? Para

null 12 Dec 3, 2022
This Repository implements an Authenticated Websocket Server built in Node Js along ws library.

websockets-authentication-server This Repository implements an Authenticated Websocket Server built in Node Js along ws library. Features Authenticate

M.Abdullah Ch 7 May 5, 2023
it is websocket-store for using easily websocket

Socket-Store It is Websocket Store How to use 1. Install # npm npm install socket-store # yarn yarn add socket-store 2. Create MessageHandler and

nerdchanii 4 Sep 13, 2022
A serious cat corporation. (v03)(A game i'm making)

Introduction | Introdução This project was initially made to teach a friend of mine, from the basics of HTML to the advanced stuff of JS in a fun way.

Drayan Silva Magalhães 2 Sep 26, 2022
Super Cat Meow Squad! 🐱

This page dynamically displays the 6 members of the SCMS and contains some interactions with other users interested in them, like commenting on them or a like counter for each kitten.

Saadat Ali 4 Mar 11, 2022
The Power CAT code components are a set of Power Apps component framework (PCF) controls that can be used to enhance power apps.

Power CAT code components The Power CAT code components are a set of Power Apps component framework (PCF) controls that can be used to enhance power a

Microsoft 70 Jan 2, 2023
tRPC test & precursor to a billion dollar social cat network

CatMash What is this? Have you ever wanted to rank 11,000 cat pictures by cuteness? Of course you have. That's what we're doing here. This is an app b

Christopher Ehrlich 6 Dec 18, 2022
🐈 SDK for Console Cat.

Console Cat SDK Console Cat is a drop-in (cat-themed) telemetry solution for CLIs. We make it easy to track usage so that you can build a better CLI!

Console Cat 5 Jul 24, 2022
On-site cat on the console!

Genbaneko Let's display "Yoshi!" on the console. When the code just won't work, when debugging is too tedious, this makes everything better! (It won't

moons 10 Nov 7, 2022