ambevar-dotfiles/.scripts/netmap

25 lines
459 B
Bash
Executable File

#!/bin/sh
if [ $# -ne 1 ] || [ "$1" = "-h" ] ; then
cat<<EOF
Usage: ${1##*/} IP
Print the map of the network associated to the provided IP.
EOF
exit
fi
## Network operations
if ! command -v nmap >/dev/null; then
echo "nmap required."
exit
fi
echo "$1"
for SCANIP in $( nmap -sL "$1" | grep -i "\([[:digit:]]\+\.\)\{3,\}[[:digit:]]\+" | awk '{print $5}' ); do
sudo nmap -oX - -n -sT -T Normal -O -sR -I -F -P0 "$SCANIP"
echo
done