lookup/port.sh
2022-10-27 13:52:03 +02:00

23 lines
400 B
Bash
Executable File

#!/bin/bash
if [ -z "$1" ]
then
echo "You must specify a filename to read from"
exit 1
fi
if [ ! -f "$1" ]
then
echo "File $1 does not exist or is not a file"
exit 1
fi
if [ -z "$2" ]
then
echo "Please, specify a port"
exit 1
fi
while read ip n
do
nc -z -v -w1 "$ip" "$2"
# [[ -z "$resolvedIP" ]] && echo "$ip" lookup failure || echo "$ip" resolved to "$resolvedIP"
done < $1