Advertisement
Pain_R

sql server scanner

Apr 23rd, 2014
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.47 KB | None | 0 0
  1. <?php
  2.  
  3. //ReCoded by Pendekar Hitam - Fiber Linux
  4. //Thanks to Lagripe-Dz
  5. //Add some new - error/function/logs/ping timeout/minor info
  6. //Malaysia Newbi3
  7.  
  8. @set_time_limit(0);
  9. @error_reporting(E_ALL | E_NOTICE);
  10.  
  11. if(!$argv[1] or !$argv[2]){
  12.  
  13. print_r("
  14. ================================================================================
  15. USAGE : php sql.php [IP] [FILENAME]
  16. Example    : php sql.php 127.0.0.1 sql.txt
  17. Blog : cyb3rsyn.blogspot.com
  18.  
  19. ================================================================================
  20. ");
  21. die();
  22.  
  23. }
  24.  
  25.  
  26. function check_url($url,$source,$filename){ // By Pendekar Hitam ft Macklemore
  27. if (preg_match("/error in your SQL syntax|mysql_fetch_array()|array_merge()|execute query|filesize()|getimagesize()|pg_exec()|mysql_fetch_object()|mysql_num_rows()|mysql_result()|session_start()|mysql_fetch_assoc()|mysql_fetch_row()|SELECT * FROM|supplied argument is not a valid MySQL|Syntax error|Fatal error/i",$source))  {
  28. echo "[+] Found -> $url\n";
  29. $rr=fopen($filename,"a+");
  30. fwrite($rr,$url."\n");
  31. }
  32. else{ echo "[-] Not Found -> $url\n"; }
  33. }
  34.  
  35. function check_sql_inj($site,$filename2){
  36.     $result = @file_get_contents("$site%27");
  37.     check_url($site,$result,$filename2);
  38.     }
  39.  
  40. function mystripos($haystack, $needle){
  41.     return strpos($haystack, stristr( $haystack, $needle ));
  42.     }
  43.    
  44. function sec($ent)
  45. {
  46. $bb = str_replace("http://", "", $ent);
  47. $cc = str_replace("www.", "", $bb);
  48. $dd = substr($cc, 0, mystripos($cc, "/"));
  49. return $dd;
  50. }
  51. $npages = 50000;
  52.  
  53.   $npage = 1;
  54.   $allLinks = array();
  55.                 $ip = $argv[1];
  56.        
  57.   while($npage <= $npages)
  58.   {
  59.     $ch = curl_init();
  60.                                
  61.     curl_setopt($ch, CURLOPT_URL, 'http://www.bing.com/search?q=ip%3A' . $ip . '+id=&first=' . $npage);
  62.     curl_setopt($ch, CURLOPT_HEADER, 1);
  63.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  64.     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
  65.     curl_setopt($ch, CURLOPT_REFERER, 'http://www.bing.com/');
  66.     curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8');
  67.  
  68.     $result['EXE'] = curl_exec($ch);
  69.     $result['ERR'] = curl_error($ch);
  70.  
  71.     curl_close($ch);
  72.  
  73.     if ( empty( $result['ERR'] ) )
  74.     {
  75.         preg_match_all('(<div class="sb_tlst">.*<h3>.*<a href="(.*)".*>(.*)</a>.*</h3>.*</div>)siU', $result['EXE'], $findlink);
  76.         for ($i = 0; $i < count($findlink[1]); $i++)
  77.         array_push($allLinks,$findlink[1][$i]);
  78.  
  79.  
  80.         $npage = $npage + 10;
  81.         if (preg_match('(first=' . $npage . '&amp)siU', $result['EXE'], $linksuiv) == 0)
  82.             break;             
  83.     }
  84.     else
  85.         break;
  86.   }
  87.  
  88. $allDmns = array();
  89.  
  90.  
  91.  
  92.     foreach ($allLinks as $kk => $vv){
  93.     $allDmns[] = $vv;
  94.     }
  95.     $resultPages = array_unique($allDmns);
  96.     sort($resultPages) ;
  97.    
  98. print_r("
  99. ================================================================================
  100.                       SQL Injection Server Scanner v2.0
  101.                           Re(c)oded By Pendekar Hitam
  102.                              cyb3rsyn.blogspot.com
  103.                              
  104.                                
  105. ================================================================================
  106. ");
  107.  
  108. for ($x = 0; $x < count($resultPages); $x++){
  109. $h3h3 = $resultPages[$x];
  110. check_sql_inj($h3h3,$argv[2]);
  111. }
  112.  
  113. print_r("
  114. ================================================================================
  115.            INFO / IP : ".$ip." / Domain Scanned : ".count($resultPages)."
  116.            
  117.                          FINISHED
  118.                              
  119. ================================================================================
  120. ");
  121. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement