Giter Site home page Giter Site logo

wscat's People

Contributors

3rd-eden avatar andrewgnagy avatar andypayne avatar connor4312 avatar enriquegh avatar greenkeeper[bot] avatar iggyvolz avatar jnordberg avatar joshgordon avatar lotkao avatar lpinca avatar mahdi-shojaee avatar nwwells avatar pgrzesik avatar shadowlmd avatar towc avatar zinid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wscat's Issues

Reload terminal screen every time new data comes in

First of all, this is an amazing and simple solution.

I am using wscat in order to get data from my server, but since the same object is sent every time just with different values, I was wondering if it could be possible to reload the screen every time new data comes in (preferably via a flag), that way I would have a live representation of the state of the data in the server.

If there is already a way to do this (maybe with the -x command) please let me know.

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?

extraneous output

The extraneous output (colors, > and < characters) makes it very hard to use this program with other programs that expect unmodified data from stdin and stdout:

$ wscat -c ws://localhost:8081/sync 

connected (press CTRL+C to quit)

< 6

<���0"/�
+["55e06327e530a87a3f21f1f852681dc1","sync"]
> 

This makes it difficult for me to take the data and feed it into another program. For example, here I've got forkdb running in the browser and I would like to sync that to a forkdb running on the server using just stdin and stdout but the line numbers, colors, status logging, and decoration gets in the way of that use case.

This is very un-like netcat, which just provides a raw undecorated stream on stdin and stdout.

In the mean time, I whipped up wsnc but I think it would be better for this package to remove decoration.

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?

wscat -x causes data stream to stop?

If I run:
wscat -c ws://<address-to-my-websocket> -x 385

This will start a stream of gps positions for the specified unit. However after ca 32 seconds or 32 positions the stream stops.

However if I send the command manually:

wscat -c ws://<address-to-my-websocket>
> 385

The stream does not stop.

I need to send the first command automatically. Is there a way to fix so that the flag -x does not cause the stream to stop? Or another alternative to achieve the same result?

Wait for a connection to process the input

Firstly, thanks for your work.

Piped input doesn't work for me, please could you wait for a connection to process the input?

echo "hi!" | /usr/local/bin/wscat -c ws://echo.websocket.org
hi!
connected (press CTRL+C to quit)
> 

Send Commands

Is there a way to send commands and pipe output (using -x for example flag in this case)?

wscat -c ws://localhost9222 -x "{"id": 1, "method": "Network.enable"}"

wscat -c ws://localhost9222 -x "{"id": 1, "method": "Page.navigate", "params" : {"url" : "http://www.github.com"}}" > out.log

Ideally, pass a command and somehow pipe output? Does this functionality already exist or is there an easy way to accomplish this?

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.

keep alive

It would be cool if the client could implement a keep alive and have that be configurable as a command line option.

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!

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

release to npm

notably, for the client cert support. happy to do this for you if you add me to the project.

Disabling SNI

Is there a way to disable SNI with wscat? I'm trying to mimic the behaviour of a remote device that does not support SNI and I want to see how AWS responds. If wscat already can do this, I'm not finding any documentation. If not, could it be added?

I'm not familiar with the SNI details but I have tried adding --host "", no effect - but I'm not sure --host is even SNI related.

wish to support gzip

It is a great tool and helpt me a lot~

while today I met a websocket application which need decompress.

so~I wish it can support gzip one day

wscat node module not connected

i have install node npm after that install wscat. I try to connect it with localhost but it is not working.

// with localhost

wscat -c ws://localhost:8000
wscat -c ws://0.0.0.0:8000

// with local ip address

wscat -c ws://192.168.1.159:8000
wscat -c ws://127.0.0.1:8000

Geting same error

error: Error: connect ECONNREFUSED 127.0.0.1:8000

get same error

/var/www/html/index.js

var WebSocketServer = require('/usr/local/lib/node_modules/wscat').Server,
wss = new WebSocketServer({ port: 8888 });

wss.on('connection', function (connection) {
console.log("User connected");
connection.on('message', function (message) {
console.log("Got message:", message);
});
connection.send('Hello World');
});

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

Error: Cannot find module 'commander'

I'm getting the following error message. Tried it with wscat installed through sudo apt install node-ws and by cloning this repo. Both have the same result:

module.js:550
    throw err;
    ^

Error: Cannot find module 'commander'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/user/wscat/bin/wscat:11:17)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)

Sorry, some details:

  • nodejs --version => v8.16.1
  • System: Ubuntu 16.04 LTS

wscat Sends different GET Header through Proxy

I'm calling wscat against two different ports:

Simple node.js WebSocket Server:
wscat --connect ws://uri:8000

NGINX Proxy:
wscat --connect ws://uri:80

tcpdump shows the following:

The header in the GET to the node server includes:

Connection: Upgrade
Upgrade: websocket

The header in the GET to the NGINX server only has:

Connection: keep-alive

Why would this happen?

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)
> %

Not a typed array

I just installed wscat but:

$ wscat -c ws://localhost:8080/ws
/usr/local/lib/node_modules/wscat/node_modules/ws/lib/PerMessageDeflate.js:8
const TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]);
                       ^

TypeError: this is not a typed array.
    at Function.from (native)
    at Object.<anonymous> (/usr/local/lib/node_modules/wscat/node_modules/ws/lib/PerMessageDeflate.js:8:24)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/wscat/node_modules/ws/lib/WebSocket.js:16:27)
    at Module._compile (module.js:410:26)

All invocations of wscat ends this way.

IDK if this is of any importance:

$ npm version
{ npm: '3.5.2',
  ares: '1.10.1-DEV',
  http_parser: '2.5.0',
  icu: '55.1',
  modules: '46',
  node: '4.2.6',
  openssl: '1.0.2g-fips',
  uv: '1.8.0',
  v8: '4.5.103.35',
  zlib: '1.2.8' }

Don't move cursor when receiving a ping

I'm connecting to a service that sends ping messages to detect client disconnect. Because I'm not an Olympic gold medalist in typing, I can't finish writing a message before I get a ping. wscat prints "< Received ping" on the console, and moves my cursor to the beginning of the line. Ideally, it should stay where it was.

show ws close reason

Closing a connection can also have a reason string specified by a server, that tends to be useful when debugging some APIs.

Current behaviour of wscat is it only shows the closing code (the number), but not the reason string

Error when passing multiple query string params

I was trying to connect to a websocket using wscat and passing params through the query string. When passing one parameter, this worked successfully. But when trying to pass multiple parameters a connection request was never sent to the websocket.

This worked: wss://websocketurl.com?some_id=1234

This did not work: wss://websocketurl.com?some_id=1234&another_id=5678

Trying to pass multiple params in the query string printed out the following to the console on each subsequent attempt.

[1] 96022
[2] 96063
[3] 96070
[4] 97671
[5] 97674

This looks like maybe an incrementing id coming from wscat and a process id?

I'm not quite sure why that second query param is causing it to not attempt a connection.

Thanks for any help!

SyntaxError: Use of const in strict mode.

pi@RasPagerC9000PCBTest:~ $ wscat -c ws://echo.websocket.org

/usr/local/lib/node_modules/wscat/node_modules/ws/index.js:9
const WebSocket = require('./lib/WebSocket');
^^^^^
SyntaxError: Use of const in strict mode.
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/wscat/bin/wscat:17:17)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
pi@RasPagerC9000PCBTest:~ $

OS: Jessie lite

add option to hide ping messages

Pings can get distracting, and maybe I'd like to copy the whole ws transcript without needing to worry about them.

Would also be a temporary fix to #84

I suggest -P

how to use self-signed certificate

how to use self-signed certificate for access wss://
'-n' option looks just ignore SSL verification.
for example,
'curl' command can select specific certificate file by below example
curl --cacert ... --capath ...

wscat closing connection with code 1006

I am using wscat to connect to a secure websocket with --no-check parameter and on server side i have asp.net core websocket listener. I can connect to websocket but wscat drops connection exactly after 1 minute with code 1006 and on server side there is exception of type WebSocketException with message - "The remote party closed the websocket connection without completing the close handshake" .

Keep open after --execute -x option?

Seems like the connection closes immediately after invoking with the -x option?

passing -w seems allows for arbitrarily specifying a wait time. Is there a way to keep open after -x ?

Proxy Support

is there a way to configure an http proxy with wscat's cli ?

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Implement slash commands in listen mode

Currently, the slash commands (/ping, /pong and /close) are only usable in client mode. wscat does not try to use them in listen/server mode. It would be great if they were usable in listen mode too.

newLine

wscat is not sending \n at the end of the lines. Add an option so all the input is send, including the new lines.

wscat emits colours even when not emitting data to a terminal

Colours should be used only in a terminal, and there should be an option to disable them too.

$ wscat --connect  ws://somewhere | xxd | head
0000000: 1b5b 324b 1b5b 451b 5b33 326d 636f 6e6e  .[2K.[E.[32mconn
0000010: 6563 7465 6420 2870 7265 7373 2043 5452  ected (press CTR
0000020: 4c2b 4320 746f 2071 7569 7429 1b5b 3339  L+C to quit).[39
0000030: 6d0a 3e20 1b5b 324b 1b5b 451b 5b33 346d  m.> .[2K.[E.[34m
0000040: 3c20 7b22 7473 223a 3134 3738 3038 3537  < {"ts":14780857
0000050: 3139 2e38 392c 2264 6174 6122 3a5b 5b22  19.89,"data":[["
...

Please use isatty.

Regression: subprotocol nolonger works

Specifying a subprotocol via -s (such as 'echo-protocol') no longer works.

Working as at release 2.1.0
Not working at release 2.2.0

Currently running release 2.10

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.