2 ms·
I think you are mistaken. /dev/tcp is not visible in /dev or devtmpfs, however it most definitely works. $ nc -l 8080 & [1] 13694 $ echo hi >> /dev/tcp/127.0
by SEJeff 12y ago
I think you are mistaken. /dev/tcp is not visible in /dev or devtmpfs, however it most definitely works.
$ nc -l 8080 &
[1] 13694
$ echo hi >> /dev/tcp/127.0.0.1/8080
hi
[1]+ Done nc -l 8080
I just tried it on a relatively diverse set of distros. Depending on the version of netcat, if it is an ancient one on an older distribution such as say RHEL4, you have to do:
nc -l -p 8080
However, the same echo command works in all of them.
- crypt1d 12y agoExactly. Its been available for a while now on most distros, I even used it on some legacy AIX systems running Korn shell. Btw, the reason why this works even if you dont see anything in /dev/tcp is because when you try to open a socket in bash using /dev/tcp it doesn't talk with the pseudo-filesystem of /dev. Bash actually intercepts the command and issues a connect() to the remote host.