wscat icon indicating copy to clipboard operation
wscat copied to clipboard

Send Commands

Open mearnsb opened this issue 9 years ago • 2 comments

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?

mearnsb avatar May 26 '17 17:05 mearnsb

I needed to do something VERY similar and since this issue is open since such a long time, I figured I give it a go myself. It's in the branch: addexecute of my fork.

Usage is pretty much as you wanted:

wscat -c ws://localhost9222 -x '{"id": 1, "method": "Network.enable"}' or wscat -c ws://localhost9222 -x '{"id": 1, "method": "Network.enable"}' > out.log

I added one more parameter do deal with slow requests.

-w or --wait <seconds> will make it wait for a set amount of seconds before quitting (default is 2 seconds)

lotkao avatar Dec 03 '17 21:12 lotkao

Done with #58

nwwells avatar Dec 06 '17 11:12 nwwells