Very simple single port scanner

This commit is contained in:
techadmin 2022-10-27 13:52:03 +02:00
parent 4085bd8a4c
commit 46c57f4ac1

23
port.sh Normal file → Executable file
View File

@ -1 +1,22 @@
# #!/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