When I try to run the following command:
echo -e "GET / HTTP/1.1nn" | /dev/tcp/18.104.22.168/80
I get the following error message:
bash: /dev/tcp/22.214.171.124/80: No such file or directory
The following command works perfectly, so the problem involves how I’m using
echo -e "GET / HTTP/1.1nn" | nc 126.96.36.199 80
I’m in Ubuntu 13.04, so the capability should be on my system. What am I doing wrong? What are the rules for using
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
You have to use it in redirections:
Bash handles several filenames specially when they are used in
redirections, as described in the following table:
If host is a valid hostname or Internet address, and port is an
integer port number or service name, Bash attempts to open the
corresponding TCP socket.
printf "GET / HTTP/1.1nn" > /dev/tcp/188.8.131.52/80
is the right way to use it.
When you used
/dev/tcp/184.108.40.206/80 in a pipe,
bash attempted to run a command named
/dev/tcp/220.127.116.11/80 and reported an error because that file didn’t exist.
The ability to handle
/dev/udp/host/port in redirection was added to
bash in version 2.04.
You need to compiled