netscan (322B)
1 #!/usr/bin/env bash 2 INTERFACE=${1:-$(ifconfig | grep ^e | cut -d":" -f1 | head -n1)} 3 echo "using interface $INTERFACE" 4 IPRANGE=$(ifconfig $INTERFACE | grep inet\ | cut -d" " -f6 | cut -d"." -f1-3)".1-255" 5 echo "scanning $IPRANGE for open ports" 6 CMD="sudo nmap -Pn --top-ports=10 --open $IPRANGE" 7 echo "running: $CMD" 8 $CMD