Created
April 13, 2017 12:49
-
-
Save rosivaldo/b72f7344fca1dc486552c1ac3c4fc451 to your computer and use it in GitHub Desktop.
Small utility to check hosts on your network with nmap. Very simple and handful for me.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z $1 ] | |
then | |
echo "type livehosts network [port]" | |
exit -1 | |
fi; | |
if [ -z $2 ] | |
then | |
echo "hosts found on network: "$1 | |
nmap -n -sP $1 | grep report | awk '{print $5}' | |
exit 0 | |
fi; | |
echo "hosts found on network: "$1 | |
echo "with port: "$2 | |
nmap -oG /tmp/outputfile.txt -T4 -F $1 > /dev/null | |
grep $2'/open' /tmp/outputfile.txt | awk '{print $2}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment