jeudi 3 janvier 2019

testing connexion with netcat command on linux

I want to make a script to check if the connections are well established between the machine on which the script is running and other remote machines.

For that I created a file csv ("test.csv") with my ip addresses as well as my ports and I begin by writing this:

cat test.csv | while read line
do

IP=$(echo $line | awk -F ";" '{print $1}')
PORT=$(echo $line | awk -F ";" '{print $2}' | sed 's/\r//g')

nc -v $IP $PORT

However the nc is only performed on the first line of my file :

enter image description here

I think it's because the nc command does not let the hand but I'm not sure: /

Thank you in advance for your help

Aucun commentaire:

Enregistrer un commentaire