Hacker News new | ask | show | jobs
by drinchev 4916 days ago
faucet 80 --in cat

This is useful for creating a connection for receiving the input of what you get...

e.g. running

faucet 80 --in cat

and later

curl http://127.0.0.1:80

will deliver to you console :

GET / HTTP/1.1 User-Agent: curl/7.21.4 (i686-pc-linux-gnu) libcurl/7.21.4 OpenSSL/0.9.8n zlib/1.2.5 libidn/1.19 Host: 127.0.0.1:900 Accept: /

2 comments

Just some additional information:

Faucet is part of "netpipes", which is available for most Unixoid operating systems. I guess it was inspiration to build "netcat". But netcat was a absolute terrible hack of a program, so "socat" (socket-cat?) was born.

http://www.dest-unreach.org/socat/

In case you need the functionality of bash's /dev/tcp [1] and you are pondering to install netcat or netpipes, do yourself a favor and just go for socat, it's insanely more powerful, read the manpage, read the examples!

http://www.dest-unreach.org/socat/doc/socat.html#EXAMPLES

--

[1] but debian and ubuntu have decided to compile without it... https://bugs.launchpad.net/ubuntu/+source/bash/+bug/215034

Alternatively you could do

  netcat -l -p 80