diff --git a/port.sh b/port.sh old mode 100644 new mode 100755 index 4287ca8..60c8664 --- a/port.sh +++ b/port.sh @@ -1 +1,22 @@ -# \ No newline at end of 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