This is another version of the ping sweep one-liner script. To show the OUI (Ethernet interface manufacturer) it needs to be run locally (to scan the locally connected networks).
Ubuntu version:
for i in {1..10} do ( ip="10.0.1.$i" up=`ping -n -q -W1 -c2 $ip | fgrep transmitted | sed -e 's/.*100%.*/down/' -e 's/.*0%.*/up/'` mac=`arp -an $ip | awk '{print $4}'` oui=`fgrep $(echo $mac | tr -d ":" | head -c6 | tr '[a-z]' '[A-Z]') /usr/share/ieee-data/oui.txt | sed -e 's/^.*)..//'` name=`host $ip | awk '/pointer/{print $NF}'` echo $ip $up $name $mac $oui ) 2>/dev/null & done | sed -e 's/<incomplete>//' -e 's/entries//' | sort -n -t. -k4
Result:
10.0.1.1 down 10.0.1.2 down 10.0.1.3 up host1. 00:08:9b:c0:ff:ee ICP Electronics Inc. 10.0.1.4 down 10.0.1.5 down host2. 10.0.1.6 up nas3. 52:54:00:c0:ff:ee 10.0.1.7 down laptop. 10.0.1.8 down 10.0.1.9 up switch2. 88:51:fb:c0:ff:ee Hewlett Packard 10.0.1.10 down printer.
RedHat/CheckPoint firewall version:
for i in {1..10} do (ip="10.0.1.$i" up=`ping -n -q -W1 -c2 $ip | fgrep transmitted | sed -e 's/.*100%.*/down/' -e 's/.*0%.*/up/'` mac=`arp -an $ip | awk '{print $4}'` oui=`fgrep $(echo $mac | tr -d ":" | head -c6 | tr '[a-z]' '[A-Z]') /usr/share/hwdata/oui.txt | sed -e 's/^.*)..//'` name=`host $ip | awk '/pointer/{print $NF}'` echo $ip $up $name $mac $oui ) 2>/dev/null & done | sed -e 's/<incomplete>//' -e 's/entries//' | sort -n -t. -k4
The OUI database /usr/share/ieee-data/oui.txt
(for Ubuntu) or /usr/share/hwdata/oui.txt
(for RedHat/CheckPoint) should be kept up-to-date.
Semi-colon separated version for Ubuntu:
for i in {1..10} do (ip="10.0.1.$i" up=`ping -n -q -W1 -c2 $ip | fgrep transmitted | sed -e 's/.*100%.*/down/' -e 's/.*0%.*/up/'` mac=`arp -an $ip | awk '{print $4}'` oui=`fgrep $(echo $mac | tr -d ":" | head -c6 | tr '[a-z]' '[A-Z]') /usr/share/ieee-data/oui.txt | sed -e 's/^.*)..//'` name=`host $ip | awk '/pointer/{print $NF}'` echo "$ip;$up;$name;$mac;$oui" ) 2>/dev/null & done | sed -e 's/<incomplete>//' -e 's/entries//' | sort -n -t. -k4
Result:
10.0.1.1;down;;; 10.0.1.2;down;;; 10.0.1.3;up;host1.;00:08:9b:c0:ff:ee;ICP Electronics Inc. 10.0.1.4;down;;; 10.0.1.5;down;host2.;; 10.0.1.6;up;nas3.;52:54:00:c0:ff:ee; 10.0.1.7;down;laptop.;; 10.0.1.8;down;;; 10.0.1.9;up;switch2.;88:51:fb:c0:ff:ee;Hewlett Packard 10.0.1.10;down;printer.;;