1

Imagine I have a server. If I set up a JavaScript to use the HTTP POST, would I receive that data using a NetCat command listening on port 8000 (the default POST port, I think)? Or does NetCat only read other NetCat messages being sent to it?

Thanks

1

If you have netcat listening on a port, it will listen for all traffic being sent to that port, not just from another netcat process. You can use it for file transfers or even HTTP requests, like you are referring to.

It is extremely useful when viewing headers and such from incoming HTTP requests, although most of the time, rather than rigging my own via netcat, I prefer to use small on-the-fly HTTP servers such as python -m SimpleHTTPServer, which listens on port 8000 by default, or my favorite, the http-server package for Node.js available via npm, which allows you to easily specify a listening port, as well as caching options.

You may want to use some additional options or pipes depending on how you want it to interpret the packets being sent, but yes, it will grab all traffic coming to the port you are listening on.

There are also different versions of netcat that offer more robust options, such as the BSD version, which is available for most OS distributions. Although the following may be irrelevant to the question, there is also socat, which is pretty much the equivalent of netcat on steroids.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.