t3ll0

ip reverse domain bash

Apr 1st, 2013
80
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3.  
  4.  
  5. # "***********************************************************************"
  6.  
  7.  
  8.  
  9. # "* In The Name Of ALLAH *"
  10.  
  11.  
  12.  
  13. # "* IrIsT Reverse IP Domain Checker *"
  14.  
  15.  
  16.  
  17. # "* www.IrIsT.Ir *"
  18.  
  19.  
  20.  
  21. # "* Coded By : Beni_Vanda *"
  22.  
  23.  
  24.  
  25. # "* Gr33tz : Am!r ,C0dex ,B3HZ4D ,TaK.FaNaR ,0x0ptim0us ,MR.F@RDIN *"
  26.  
  27.  
  28.  
  29. # "* skote_vahshat ,M.R.S.CO ,Net.W0lf , IR Anonymous, joker_s *"
  30.  
  31.  
  32.  
  33. # "* && All Turkish/Iranian/Kurdish Hackerz *"
  34.  
  35.  
  36.  
  37. # "* Beni_Vanda@yahoo.com *"
  38.  
  39.  
  40.  
  41. # "***********************************************************************"
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. #Used This servers
  50.  
  51.  
  52.  
  53. #http://www.bing.com
  54.  
  55.  
  56.  
  57. #http://www.my-ip-neighbors.com/
  58.  
  59.  
  60.  
  61. #http://ip.kenh12.com/Reverse-IP-Lookup-DNS-Domain/
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. F_ARG=$1
  74.  
  75.  
  76.  
  77. IP=
  78.  
  79.  
  80.  
  81. page=0
  82.  
  83.  
  84.  
  85. last_page_check=
  86.  
  87.  
  88.  
  89. how_many=1
  90.  
  91.  
  92.  
  93. single_page=
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101. function Usage()
  102.  
  103.  
  104.  
  105. {
  106.  
  107.  
  108.  
  109. echo ""
  110.  
  111.  
  112.  
  113. echo "# ********************************************************************************​​******#"
  114.  
  115.  
  116.  
  117. echo "# Usage : IrIsT-Reverse-IP.sh [IP/Domain] *#"
  118.  
  119.  
  120.  
  121. echo "# Help : -h && --help : Show This Menu *#"
  122.  
  123.  
  124.  
  125. echo "# RunScript : give permision to script and run it ./IrIsT-Reverse-IP.sh <IP> *#"
  126.  
  127.  
  128.  
  129. echo "# ********************************************************************************​​******#"
  130.  
  131.  
  132.  
  133. echo ""
  134.  
  135.  
  136.  
  137. }
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145. # check for arguments
  146.  
  147.  
  148.  
  149. if [ -z "$F_ARG" ] || [ "$F_ARG" == "-h" ] || [ "$F_ARG" == "--help" ]; then
  150.  
  151.  
  152.  
  153. Usage;
  154.  
  155.  
  156.  
  157. exit 1
  158.  
  159.  
  160.  
  161. fi
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169. # check IP
  170.  
  171.  
  172.  
  173. if [ `echo "$F_ARG" | egrep "(([0-9]+\.){3}[0-9]+)|\[[a-f0-9:]+\]"` ]; then
  174.  
  175.  
  176.  
  177. IP="$F_ARG"
  178.  
  179.  
  180.  
  181. else
  182.  
  183.  
  184.  
  185. IP=`resolveip -s "$F_ARG"`
  186.  
  187.  
  188.  
  189. if [ "$?" != 0 ]; then
  190.  
  191.  
  192.  
  193. echo "Error: cannot resolve $F_ARG to an IP"
  194.  
  195.  
  196.  
  197. exit
  198.  
  199.  
  200.  
  201. fi
  202.  
  203.  
  204.  
  205. fi
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217. # Check Sever Status
  218.  
  219.  
  220.  
  221. ping -c 3 $IP
  222.  
  223.  
  224.  
  225. if [ $? -ne 0 ]
  226.  
  227.  
  228.  
  229. then
  230.  
  231.  
  232.  
  233. echo "Server $IP is down :| >> Program Exit "
  234.  
  235.  
  236.  
  237. exit 1
  238.  
  239.  
  240.  
  241. fi
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249. echo ""
  250.  
  251.  
  252.  
  253. echo "Server $IP Status = On Going to Reverse IP "
  254.  
  255.  
  256.  
  257. echo ""
  258.  
  259.  
  260.  
  261. echo "Reversed Domain will be Store at all_server_reversed.txt ..."
  262.  
  263.  
  264.  
  265. echo "starting ..."
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273. echo "[*] now going to use neighbors server ... "
  274.  
  275.  
  276.  
  277. echo "[*] Trying ..."
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285. url_neighbors="http://www.my-ip-neighbors.com/?domain=$IP"
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293. wget -q -O my-ip-neighbors.php "$url_neighbors"
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301. cat my-ip-neighbors.php | egrep -o '<td class="action" target="_blank"><a href="http://whois.domaintools.com/[^"]+' | cut -d '/' -f4 | sort | uniq >> whois_neighbors.txt
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313. echo "[*] now going to use ip-kenh12 server ... "
  314.  
  315.  
  316.  
  317. echo "[*] Trying ..."
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325. url_kenh12="http://ip.kenh12.com/Reverse-IP-Lookup-DNS-Domain/$IP.html"
  326.  
  327.  
  328.  
  329. wget -q -O my-ip-kenh12.php "$url_kenh12"
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337. cat my-ip-kenh12.php | egrep -o "gif' alt=[^>]+" | cut -d '=' -f2 | sed '/www./s///g' | sort | uniq >> whois_kenh12.txt
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345. echo "[*] now going to use bing server ... "
  346.  
  347.  
  348.  
  349. echo "[*] Trying ..."
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357. while [ -z "$last_page_check" ] && [ -n "$how_many" ] && [ -z "$single_page" ]; do
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365. url="http://www.bing.com/search?q=ip%3A$IP&go=&qs=n&first=${page}0&FORM=PERE"
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373. out=`mktemp -p /tmp -t IrIsT_Reverse_IP_Bing.tmp.XXXXXX`
  374.  
  375.  
  376.  
  377. wget -q -O "$out" "$url"
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385. last_page_check=`egrep -o '<span class="sb_count" id="count">[0-9]+-([0-9]+) of (\1)' $out`
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393. # if no results are found, how_many is empty and the loop will exit
  394.  
  395.  
  396.  
  397. how_many=`egrep -o '<span class="sb_count" id="count">[^<]+' $out|cut -d '>' -f 2|cut -d ' ' -f 1-3`
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405. # check for a single page of results
  406.  
  407.  
  408.  
  409. single_page=`egrep -o '<span class="sb_count" id="count">[0-9] results' $out`
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421. cat "$out"| egrep -o "<h3><a href=\"[^\"]+" $out |cut -d '"' -f 2 >> alldomain_bing.txt
  422.  
  423.  
  424.  
  425. # rm -f "$out"
  426.  
  427.  
  428.  
  429. let page=$page+1
  430.  
  431.  
  432.  
  433. done
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441. cat alldomain_bing.txt | cut -d '/' -f 3 | tr '[:upper:]' '[:lower:]' | sed '/www./s///g' | sort | uniq >> whois_bing.txt
  442.  
  443.  
  444.  
  445. rm alldomain_bing.txt ;
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457. # insert whoised domain at all_server_reversed txt
  458.  
  459.  
  460.  
  461. for line_bing in `cat whois_bing.txt`
  462.  
  463.  
  464.  
  465. do
  466.  
  467.  
  468.  
  469. echo "$line_bing" >> all_server_reversed.txt
  470.  
  471.  
  472.  
  473. done
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481. for line_neighbors in `cat whois_neighbors.txt`
  482.  
  483.  
  484.  
  485. do
  486.  
  487.  
  488.  
  489. echo "$line_neighbors" >> all_server_reversed.txt
  490.  
  491.  
  492.  
  493. done
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501. for line_kenh12 in `cat whois_kenh12.txt`
  502.  
  503.  
  504.  
  505. do
  506.  
  507.  
  508.  
  509. echo "$line_kenh12" >> all_server_reversed.txt
  510.  
  511.  
  512.  
  513. done
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521. rm whois_bing.txt;
  522.  
  523.  
  524.  
  525. rm whois_neighbors.txt;
  526.  
  527.  
  528.  
  529. rm whois_kenh12.txt;
  530.  
  531.  
  532.  
  533. rm my-ip-neighbors.php;
  534.  
  535.  
  536.  
  537. rm my-ip-kenh12.php;
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545. sort all_server_reversed.txt | uniq
  546.  
  547.  
  548.  
  549. found_N=`wc -l all_server_reversed.txt | sed 's/all_server_reversed.txt//'`
  550.  
  551.  
  552.  
  553. echo "Found $found_N Host On $IP server :)"
RAW Paste Data