Advertisement
greyx

Simple bing dorker CLI

Jul 22nd, 2017
516
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. <?php
  2. set_time_limit(0);
  3. /**
  4.  * @author: jjeincovers!
  5.  * thx! sanjunganjiwa x idx!
  6.  * usage: php bing.php 'bing_dork' -> with ' (ex: php bing.php '"/admin/" site:com')
  7. */
  8.  
  9. function getsource($url) {
  10.     $curl = curl_init($url);
  11.     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  12.     $content = curl_exec($curl);
  13.     curl_close($curl);
  14.     return $content;
  15. }
  16. $do = urlencode($argv[1]);
  17. if(isset($argv[1])) {
  18.     $npage = 1;
  19.     $npages = 30000;
  20.     $allLinks = array();
  21.     $lll = array();
  22.     while($npage <= $npages) {
  23.         $x = getsource("http://www.bing.com/search?q=".$do."&first=".$npage);
  24.         if($x) {
  25.             preg_match_all('#<h2><a href="(.*?)" h="ID#', $x, $findlink);
  26.             foreach ($findlink[1] as $fl) array_push($allLinks, $fl);
  27.             $npage = $npage + 10;
  28.             if (preg_match("(first=" . $npage . "&amp)siU", $x, $linksuiv) == 0) break;
  29.         } else break;
  30.     }
  31.     $URLs = array();
  32.     foreach($allLinks as $url){
  33.         echo "$url\n";
  34.     }
  35. }
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement