| Current Path : /var/www/html/kamini/khc/ |
| Current File : //var/www/html/kamini/khc/b |
#!/bin/bash
VERSION=0.1
ANIMATION=0
if [ -z "$1" ] || [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
echo -e "Usage: $0 [--noanimation] <IP>"
exit 1
fi
if [ "$1" == "--noanimation" ]; then
ANIMATION=0
shift
ARGV=$*
fi
animation="/-\|"
IP="$1"
num_vhosts=10
page=0
all_hosts=`mktemp -p . -t ip2hosts.tmp.XXXXXX`
while [ "$num_vhosts" == 10 ]; do
if [ $ANIMATION == 1 ]; then
echo -en "${animation: $(( $page % 4 )) :1}"
fi
url="http://m.bing.com/search/search.aspx?A=webresults&Q=$IP&D=Web&SI=$page""0"
out=`mktemp -p . -t .ip2hosts.tmp.XXXXXX`
wget -q -O "$out" "$url"
vhosts=`cat "$out"| egrep -o "(<span class=\"c2\">)[^<]+(<\/)" | sed -e 's/<span class="c2">\|<\///g'`
num_vhosts=`echo "$vhosts" | wc -l`
echo -e "$vhosts" >> "$all_hosts"
rm -f "$out"
let page=$page+1
if [ $ANIMATION == 1 ]; then
echo -ne "\b"
fi
done
cat "$all_hosts" | cut -d '/' -f 1 | tr '[:upper:]' '[:lower:]' | sort | uniq
rm -f "$all_hosts"