arp notes

From Noah.org
Revision as of 15:19, 17 June 2011 by Root (Talk | contribs) (Created page with 'Category:Engineering Category:Networking == ping sweep == <pre> #!/bin/sh SUBNET="192.168.0" unset VERBOSE fourth_octet=1 while [ $fourth_octet -lt 255 ]; do …')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


ping sweep

#!/bin/sh

SUBNET="192.168.0"
unset VERBOSE

fourth_octet=1
while [ $fourth_octet -lt 255 ]; do
        # Note that this if statement is run in the background.
        if ping -c 1 -q $SUBNET.$fourth_octet 2>/dev/null >/dev/null; then
                if [ ${VERBOSE} ]; then
                        echo ${SUBNET}.${fourth_octet}
                fi
        fi &
        fourth_octet=$(($fourth_octet + 1))
done
# Wait for all the `ping` processes to finish.
wait
sleep 1
grep -v 00:00:00:00:00:00 /proc/net/arp