Skip to content

Instantly share code, notes, and snippets.

@caveatlector
Last active June 7, 2019 10:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caveatlector/1273d5095dc05e77cb916abea7c0c08e to your computer and use it in GitHub Desktop.
Save caveatlector/1273d5095dc05e77cb916abea7c0c08e to your computer and use it in GitHub Desktop.
nmap: TCP/UDP port scan array of IPs
#!/usr/bin/env bash
# Requires: nmap
TIMESTAMP=$(date +"%Y%m%d%M")
TARGETS=( ) # E.g. TARGETS=( 1.0.0.1 1.1.1.1 )
for TARGET in "${TARGETS[@]}"
do
echo "Begin scan: ${TARGET}" | tee -a nmap_${TIMESTAMP}.log
# -sT: scan TCP, -sU: scan UDP, -p0-65535: scan ports 0-65535, -v: verbose; -Pn can be added to scan even when unresponsive to nmap "ping"
nmap -p0-65535 -sT -sU -v ${TARGET} | tee -a nmap_${TIMESTAMP}.log
echo "End scan: ${TARGET}" | tee -a nmap_${TIMESTAMP}.log
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment