Skip to content

Instantly share code, notes, and snippets.

@tony-o
Created January 24, 2014 17:35
Show Gist options
  • Save tony-o/8602135 to your computer and use it in GitHub Desktop.
Save tony-o/8602135 to your computer and use it in GitHub Desktop.
#!/bin/sh
HOST=$1
PORTF=$2
PORTT=$3
echo "Scanning $HOST:$PORTF-$PORTT"
for ((PORTF; PORTT >= PORTF; PORTF++)) do
SVC=`cat /etc/services | egrep "\\s$PORTF/tcp" | awk '{print $1}'`
nc -z -w 1 -G 2 -d "$HOST" "$PORTF" || echo "[$PORTF/$SVC] Failed";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment