TIL: #bash provides pseudo devices for TCP and UDP connections:
echo "hello" > /dev/udp/127.0.0.1/1337
or
exec 5<>/dev/tcp/www.google.com/80
echo -e "GET / HTTP/1.0\n" >&5
cat <&5
I'm baffled how I've never discovered that until today.
TIL: #bash provides pseudo devices for TCP and UDP connections:
echo "hello" > /dev/udp/127.0.0.1/1337
or
exec 5<>/dev/tcp/www.google.com/80
echo -e "GET / HTTP/1.0\n" >&5
cat <&5
I'm baffled how I've never discovered that until today.
@fribbledom whoa that's bizarre, from the manpage description I wonder if they did it to mimic some previous OS functionality that they wished were available on all platforms
that exec syntax in the first line of the second example is strange! anyone know what it's called or how I could learn more about it?
also how would you close the network connection created in the second example?
wild stuff damn