Skip to content

Instantly share code, notes, and snippets.

@oliverdaff
Last active September 14, 2020 00:59
Show Gist options
  • Save oliverdaff/8968131cb723a462114716280b678f07 to your computer and use it in GitHub Desktop.
Save oliverdaff/8968131cb723a462114716280b678f07 to your computer and use it in GitHub Desktop.
Use nmap to find open ports fast and then run a detailed scans on the returned ports
#!/bin/bash
# Use nmap to find open ports fast and then run a detailed scans on the returned ports
if [ -z "$1" ]
then
echo "__nmap_fast__"
echo "Usage: ./nmap_fast TARGET_HOSTNAME"
fi
TARGET_HOSTNAME=$1
nmap -vv -max-retries 0 --min-parallelism 4500 ${TARGET_HOSTNAME} -p- \
| awk -F'[ /]' '/Discovered open port/{print $4}' \
| paste -s -d, - \
| xargs -I '{}' nmap -T4 -p {} -A ${TARGET_HOSTNAME}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment