MadAgent Posted August 27, 2014 Report Posted August 27, 2014 #!/bin/bash#Based on bing-ip2hosts v4 by Andrew Horton aka urbanadventurer, MorningStar Security#Modified by MadAgent on August 2014, released for RST Forums#Saves results to 'hosts' fileVERSION=0.5TMPDIR=./tmpANIMATION=0OUTPUTIP=1HTTPPREFIX=0IP=PREFIX=DEBUG=0rm -rf hosts > /dev/null 2>&1if [ -z "$1" ] || [ "$1" == "-h" ] || [ "$1" == "--help" ]; thenecho -e "OPTIONS are:-n\t\tTurn off the progress indicator animation-t <DIR>\tUse this directory instead of /tmp. The directory must exist.-i\t\tOptional CSV output. Outputs the IP and hostname on each line, separated by a comma.-p\t\tOptional http:// prefix output. Useful for right-clicking in the shell."exit 1fiwhile getopts "nipt:" optionName; do case "$optionName" in n) ANIMATION=0;; t) TMPDIR="$OPTARG";; i) OUTPUTIP=1;; p) HTTPPREFIX=1;; [?]) echo "Error"; exit 1;; esacdoneshift $(($OPTIND -1))if [ -z "$1" ]; then echo "need an IP or hostname" exit 1fianimation="/-\|"page=0last_page_check=how_many=1uniq_hosts=0single_page=# if the parameter looks like an IP go ahead, otherwise resolve itif [ `echo "$1" | egrep "(([0-9]+\.){3}[0-9]+)|\[[a-f0-9:]+\]"` ]; then IP="$1"else# IP=`resolveip -s "$1"` IP=`nslookup "$1" |egrep "^Address: \w+\.\w+\.\w+\.\w+$"|tail -1|awk '{ print $2 }'` # dig -t a treshna.com +short if [ "$IP" == "" ]; then echo "Error: cannot resolve $1 to an IP" exit fifiall_hosts=`mktemp -p $TMPDIR -t bing-ip2hosts.tmp.XXXXXX`while [ -z "$last_page_check" ] && [ -n "$how_many" ] && [ -z "$single_page" ]; do if [ $ANIMATION == 1 ]; then echo -ne "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" echo -en "[ $IP | Scraping $how_many | Found $uniq_hosts | ${animation: $(( $page % 4 )) :1} ]" fi url="http://www.bing.com/search?q=ip%3A$IP&go=&qs=n&first=${page}0&FORM=PERE" out=`mktemp -p "$TMPDIR" -t bing-ip2hosts.tmp.XXXXXX` wget -q -O "$out" "$url" last_page_check=`egrep -o '<span class="sb_count" id="count">[0-9]+-([0-9]+) of (\1)' $out` if [[ "$last_page_check" -eq "" ]]; then last_page_check=`egrep -o '<span class="sb_count">[0-9]+-([0-9]+) of (\1)' $out` fi if [ "$DEBUG" -eq 1 ]; then echo "Last Page Check: $last_page_check" fi # if no results are found, how_many is empty and the loop will exit how_many=`egrep -o '<span class="sb_count" id="count">[^<]+' $out|cut -d '>' -f 2|cut -d ' ' -f 1-3` if [[ "$how_many" -eq "" ]]; then how_many=`egrep -o '<span class="sb_count">[^<]+' $out|cut -d '>' -f 2|cut -d ' ' -f 1-3` fi # check for a single page of results single_page=`egrep -o '<span class="sb_count" id="count">[0-9] results' $out` if [[ "$single_page" -eq "" ]]; then single_page=`egrep -o '<span class="sb_count">[0-9] ' $out` fi if [ $DEBUG -eq 1 ];then echo "Single Page: $single_page" fi # no captcha support or detection # pages will contain "Typing the characters in the picture above helps us ensure that a person, not a program, is performing a search" vhosts=`cat "$out"| egrep -o "<h3><a href=\"[^\"]+" $out |cut -d '"' -f 2` if [[ "$vhosts" -eq "" ]]; then vhosts=`cat "$out"| egrep -o "<h2><a href=\"[^\"]+" $out |cut -d '"' -f 2` fi echo -e "$vhosts" >> "$all_hosts" uniq_hosts=`cat "$all_hosts" | cut -d '/' -f 3 | tr '[:upper:]' '[:lower:]' | sort | uniq | wc -l` if [ $DEBUG -eq 0 ]; then rm -f "$out" fi let page=$page+1 if [ $DEBUG -eq 1 ]; then echo "Page: $page" fidoneif [ $ANIMATION == 1 ]; then echofi__NSLOOKUP="$(which nslookup)"__HOST="$(which host)"if [[ "$__NSLOOKUP" != "" ]]; then echo -e "$($__NSLOOKUP $IP | grep name | awk '{ print $NF }' | sed 's/\.$//' | sed 's/ //g')" >> "$all_hosts"fiif [[ "$__HOST" != "" ]]; then echo -e "$($__HOST $IP | grep -v 'not found' | grep name | awk '{ print $NF }' | sed 's/\.$//' | sed 's/ //g')" >> "$all_hosts"fiecho -e "$(host $IP | grep -v 'not found' | awk '{ print $NF }' | sed 's/\.$//' | sed 's/ //g')" >> "$all_hosts"uniq_hosts=`cat "$all_hosts" | cut -d '/' -f 3 | tr '[:upper:]' '[:lower:]' | sort | uniq`if [ $DEBUG -eq 0 ]; then rm -f "$all_hosts"fiif [ $OUTPUTIP == 1 ]; then PREFIX="$IP,"fiif [ $HTTPPREFIX == 1 ]; then PREFIX="$PREFIX""http://"fifor h in `echo "$uniq_hosts"`do echo "$PREFIX$h" >> hostsdone Quote
sebywarlord Posted August 27, 2014 Report Posted August 27, 2014 Trebuia doar modificat din <h3> in <h2> la linia 99...Daca te uitai in temp files de la bing iti dadeai seama din prima... Quote
MadAgent Posted August 27, 2014 Author Report Posted August 27, 2014 Trebuia doar modificat din <h3> in <h2> la linia 99...Daca te uitai in temp files de la bing iti dadeai seama din prima...Pai, cam asta e, dar din teste am vazut ca pe anumite geo locatii ale serverului pune tot h3, restul de modificari sunt facute dupa nevoile mele... Quote
AdyRo Posted September 14, 2014 Report Posted September 14, 2014 Salutare!am si eu o problema cu bing daca doriti sa ma ajutati sau sa ma lamuriti .. deci am scanu asta .. cand dau ./ bing-ip2hosts ex Google nu imi gaseste nimic .raping 1 | Found 0 | / ]-ip2hosts-0.4# ./bing-ip2hosts Googletrebuie instalat ceva pe srv ? am incercat pe vre-o 10 servere si aceiasi problema am.As fi recunoscator daca m-ar ajuta cineva. Quote
MadAgent Posted September 20, 2014 Author Report Posted September 20, 2014 AdyRo, dupa cum ii spune si numele, trebuie sa pui ip in loc de Google. Foloseste varianta postata... Quote
tilicabaldovin Posted March 25, 2015 Report Posted March 25, 2015 ba nu mai merge cam de 1 an are careva varianta noua? daca o are rog sa posteze aici Quote
mojito.mojito Posted March 25, 2015 Report Posted March 25, 2015 ba nu mai merge cam de 1 an are careva varianta noua? daca o are rog sa posteze aicinormal ca nu merge daca te uiti in sursa si te uiti la regex folosita in acel script e diferit si normal ca nu prinde nimic.... doar un singur parametru trebuie schimabt si apoi merge ......... vhosts=`cat "$out"| egrep -o "<h3><a href=\"[^\"]+" $out |cut -d '"' -f 2` if [[ "$vhosts" -eq "" ]]; then vhosts=`cat "$out"| egrep -o "<h2><a href=\"[^\"]+" $out |cut -d '"' -f 2` fiin sfarsit!!!! Quote
tilicabaldovin Posted March 25, 2015 Report Posted March 25, 2015 am incercat si nu merge nu rezolva nimic. normal era sa schimbi h3 cu h2 si mergea, dar nu mai merge acum. cand facem temp ul la pagina e gol nu mai ia pagina, asa ca degeaba ii pui h2 in lic de h3 daca pagina de o ia e goala.e de la altceva, oricum pe mine nu ma duce capul mai mult, ca atunci daca stiam o faceam si nu mai intrebam Quote
tilicabaldovin Posted March 25, 2015 Report Posted March 25, 2015 site-ul astora scoate dns urile care treb la ip, dar cine stie ce script auip2host | Find hostnames resolving to the same IP address Quote
tilicabaldovin Posted March 25, 2015 Report Posted March 25, 2015 la partea asta url="http://www.bing.com/search?q=ip%3A$IP&go=&qs=n&first=${page}0&FORM=PERE" out=`mktemp -p "$TMPDIR" -t bing-ip2hosts.tmp.XXXXXX` wget -q -O "$out" "$url"tmp-ul e gol, nu mai ia sursa la pagina. daca intelege careva ce are, rog sa il posteze refacut.Multumesc Quote
tilicabaldovin Posted March 25, 2015 Report Posted March 25, 2015 tot vasale o rezolva:)))la url= inlocuiti cu url-ul asta http://www.bing.com/search?q=ip:$IP&pc=MOZI&first=%s&FORM=PERE3unde face wget pe el. Quote
mojito.mojito Posted March 25, 2015 Report Posted March 25, 2015 root@localhost:~/Downloads/php# ./bing 80./bing: 16: ./bing: +: not found\e[0m-e \e[1;37;1m[\e[1;32;1m+\e[1;37;1m]BING: 0 of 9125370 @ip2host\e[0m./bing: 16: ./bing: +: not found\e[0m-e \e[1;37;1m[\e[1;32;1m+\e[1;37;1m]BING: 0 of 9125370 @ip2host\e[0m./bing: 1root@localhost:~/Downloads/php# ./clean urls.txtroot@localhost:~/Downloads/php# cat wwwav.cookchildrens.orgcookiris.cookchildrens.orgcredapply.cookchildrens.orgess.cookchildrens.orgsecure.cookchildrens.orgwww.berkeley-public.orgwww.campsanguinity.orgwww.centerforchildrenshealth.orgwww.cookchildrenshomehealth.comwww.cookchp.comwww.cookchp.orgwww.pedspal.orgLa mine merge! cine il vrea sami dea pm ca vil dau al toti care imi dau pm Quote
mojito.mojito Posted March 25, 2015 Report Posted March 25, 2015 site-ul astora scoate dns urile care treb la ip, dar cine stie ce script auip2host | Find hostnames resolving to the same IP addressSpre exemplu eu am o baza de date de cateva un miliard doua de domenii as putea face si eu ceva de genu ca in acel site. Quote
kiduHk Posted November 23, 2015 Report Posted November 23, 2015 ma poate ajuta cineva in legatura cu bing sau vreun script pentru ip2hosts ? Quote