{{tag>Brouillon Réseau Linux Devfs}}
= Remplacer Telnet / nc sous linux
Dites adieu à Telnet !
Voir :
* [[https://www.redhat.com/sysadmin/stop-using-telnet-test-port|Stop using Telnet to test ports]]
== Bash - Remplacer Telnet / nc (netcat) par /dev/tcp
Lire
cat < /dev/tcp/127.0.0.1/22
Tester la connexion
echo > /dev/tcp/127.0.0.1/22
exec 3<>/dev/tcp/www.google.com/80
echo -e "GET / HTTP/1.1\r\nhost: http://www.google.com\r\nConnection: close\r\n\r\n" >&3
cat <&3
exec 3>&-
timeout 1 bash -c " echo > /dev/tcp/${HOST}/${PORT} " > /dev/null 2>&1 && echo "Port ${PORT} is open" || echo "Port ${PORT} is closed"
== Avec curl
Ou encore
curl -v telnet://127.0.0.1:22