Skip to content

Instantly share code, notes, and snippets.

@rskelley9
Created December 22, 2015 07:37
Show Gist options
  • Save rskelley9/75084dffccdb7dc4b5da to your computer and use it in GitHub Desktop.
Save rskelley9/75084dffccdb7dc4b5da to your computer and use it in GitHub Desktop.
Scan for other computers on LAN
echo -e "\nScan LAN for other computers.\n"
if [ -n ""$@"" ]; then
ip=$(/sbin/ifconfig $1 | grep 'inet ' | awk '{ print $2}' | cut -d"." -f1,2,3 )
nmap -sP $ip.1-255
else
echo "Enter Interface parameter ex:"
echo -e "\t./scannetwork.sh $(ifconfig -lu | awk '{print $2}')\n"
echo "Available interfaces: "
for i in $(ifconfig -lu)
do
echo -e "\033[32m \t $i \033[39;49m"
done
echo "Down interfaces: "
for i in $(ifconfig -ld)
do
echo -e "\033[31m \t $i \033[39;49m"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment