Dr_FarFar

[+] Subdomain Scan 2014

Apr 9th, 2014
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.65 KB | None | 0 0
  1. /***
  2.      ▄▄▄▄▄▄▄▄▄▄   ▄▄▄▄▄▄▄▄▄▄▄     ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄
  3.     ▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌   ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
  4.     ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌   ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌
  5.     ▐░▌       ▐░▌▐░▌       ▐░▌   ▐░▌          ▐░▌       ▐░▌▐░▌       ▐░▌▐░▌          ▐░▌       ▐░▌▐░▌       ▐░▌
  6.     ▐░▌       ▐░▌▐░█▄▄▄▄▄▄▄█░▌   ▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌
  7.     ▐░▌       ▐░▌▐░░░░░░░░░░░▌   ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
  8.     ▐░▌       ▐░▌▐░█▀▀▀▀█░█▀▀    ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀█░█▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀█░█▀▀
  9.     ▐░▌       ▐░▌▐░▌     ▐░▌     ▐░▌          ▐░▌       ▐░▌▐░▌     ▐░▌  ▐░▌          ▐░▌       ▐░▌▐░▌     ▐░▌  
  10.     ▐░█▄▄▄▄▄▄▄█░▌▐░▌      ▐░▌  ▄ ▐░▌          ▐░▌       ▐░▌▐░▌      ▐░▌ ▐░▌          ▐░▌       ▐░▌▐░▌      ▐░▌
  11.     ▐░░░░░░░░░░▌ ▐░▌       ▐░▌▐░▌▐░▌          ▐░▌       ▐░▌▐░▌       ▐░▌▐░▌          ▐░▌       ▐░▌▐░▌       ▐░▌
  12.      ▀▀▀▀▀▀▀▀▀▀   ▀         ▀  ▀  ▀            ▀         ▀  ▀         ▀  ▀            ▀         ▀  ▀         ▀
  13.  
  14.                          
  15.                                              
  16. ~~~ :xD: Have Fun. Don't Forget To Bookmark This Website :xD:
  17. ~~~ https://www.FaceBook.com/Dr.FarFar
  18. ~~~ http://Dr-FarFar.BlogSpot.com/
  19.  
  20. */
  21.  
  22. ###################################################################################################
  23.  
  24. <?php
  25. echo "Welcome to bezel subdomain scan...\n";
  26. class sc {
  27.    
  28.     private $googleRequests = 15;
  29.    
  30.     public function __construct($domain){
  31.         $arrSubs = array();
  32.         echo "Starting to scan...\nProcess: ";
  33.         for($i=0;$i<$this->googleRequests;$i++) {
  34.             $qry=$this->buildQuery($domain,$arrSubs);
  35.             $tmpSubs=$this->getSubs($domain,$qry);
  36.             if(is_array($tmpSubs) && !empty($tmpSubs)) {
  37.                 foreach($tmpSubs as $sub) {
  38.                     if(!in_array($sub,$arrSubs) && $sub != "") {
  39.                             $arrSubs[]=$sub;
  40.                     }
  41.                 }
  42.             }
  43.            
  44.         }
  45.         echo "\n";
  46.         if(count($arrSubs)) {
  47.             //safe the log
  48.             file_put_contents("sclog_".$domain.".txt","Subdomain scan log of domain ".$domain."\n\n");
  49.             foreach($arrSubs as $result ) {
  50.                     echo $result . $domain . "\n";
  51.                     file_put_contents("sclog_".$domain.".txt","-".$result.$domain."\n",FILE_APPEND);                    
  52.             }
  53.             echo "Job done...have fun pwnin...\n";
  54.         } else {
  55.             echo "No subs found for ".$domain."...goin down for maintenance\n";
  56.         }
  57.     }
  58.    
  59.    
  60.     private function getSubs($domain,$qry) {
  61.         echo " *";
  62.         $urls = array();
  63.         $qry = urlencode($qry);
  64.         $ch = curl_init("http://www.google.co.uk/search?q=".$qry."&num=100");
  65.         curl_setopt($ch, CURLOPT_HEADER, 0);
  66.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  67.         curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1');
  68.         $output = curl_exec($ch);
  69.         curl_close($ch);
  70.         preg_match_all('|<h3 class="r">(.*?)</h3>|',$output,$matches);
  71.         foreach($matches[0] as $match) {
  72.             $match = explode('href="',$match);
  73.             $match = explode('"',$match[1]);
  74.             $match = $match[0];
  75.             if(substr($match,0,7) != "/search" && substr($match,0,7) != "/images") {
  76.                 $match = substr($match,7);
  77.                 $match = explode('&',$match,2);
  78.                 $match = $match[0];
  79.                 $urls[]=$match;
  80.             }
  81.         }
  82.         $return = array();
  83.         foreach($urls as $url) {
  84.                 $tmp=explode($domain,$url);
  85.                 $return[]=str_replace("ftp://","",str_replace("http://","",str_replace("https://","",str_replace("www.","",$tmp[0]))));
  86.         }
  87.         return $return;
  88.     }
  89.    
  90.    
  91.     private function buildQuery($domain,$arrSubs) {
  92.         $tmp = "site:".$domain." -site:www.".$domain;
  93.         foreach($arrSubs as $sub) {
  94.                 $tmp.= " -site:".$sub.".".$domain;
  95.         }
  96.         return $tmp . ' inurl:"https://"';
  97.     }
  98.    
  99.    
  100. }
  101. if(isset($argv[1])) {
  102.     $s=new sc($argv[1]);
  103. } else {
  104.     echo "Bzzp....missing param...shutting down ...(._.)... \n";
  105. }
  106. ?>
  107.  
  108. ########################################################################################################################
  109.  
  110.         https://www.facebook.com/Dr.FarFar
  111.         http://Dr-FarFar.BlogSpot.com/
  112.  
  113.         ________         __________                __________                
  114.         ___  __ \___________  ____/______ ____________  ____/______ _________
  115.         __  / / /__  ___/__  /_    _  __ `/__  ___/__  /_    _  __ `/__  ___/
  116.         _  /_/ / _  /___ _  __/    / /_/ / _  /    _  __/    / /_/ / _  /    
  117.         /_____/  /_/ _(_)/_/       \__,_/  /_/     /_/       \__,_/  /_/    
  118.                                                                              
  119.                              ~\ Dr.FarFar /~
Advertisement
Add Comment
Please, Sign In to add comment