Code:
#!/bin/sh
# Router-Finder - 2000-2008 Volker Tanger <tanger@wyae.de>
# time estimates for TIMING=5
# initial hostscan: 5 sec for a /24 network
# routing test: 3 sec for each pingable host
# nmap mapping: varies hugely per host: 10-300sec each
# especially embedded stuff is slow
NETWORK="192.168.0.0/16"
# external IP address to test against
TESTADR="www.wyae.de"
# timing aggressivity: (s)low=1 - insane=5
TIMING=5
LOG='routerfinder.log'
HOSTLIST='routercandidates.log'
ROUTERLIST='routerlist.log'
ROUTERDIR=`date +'routers_%Y-%m-%d'`
#===========================================================
# no configurable stuff below here
#===========================================================
if [ $UID -ne 0 ]; then
echo "ERROR: must be run as ROOT - needs to set routing"
exit 1
fi
rm -rf $ROUTERDIR
mkdir $ROUTERDIR
rm -f $ROUTERLIST $HOSTLIST
date > $LOG
/sbin/route del -host $TESTADR
echo "-------------------------------------" | tee -a $LOG
echo -n "Generating hostlist. " | tee -a $LOG
date | tee -a $LOG
#===========================================================
# scan for reachable IPs
#===========================================================
nmap -sP $NETWORK -T$TIMING -oG - | fgrep "Host:" | cut -d " " -f 2 | tee $HOSTLIST
echo "-------------------------------------" | tee -a $LOG
echo -n "Hostlist generated. " | tee -a $LOG
Download: http://www.mediafire.com/?hoka7ytejhs
Copyright: Google.Com!