Advertisement
Fakhru

Subdomain Scanner

May 20th, 2013
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. Author : Skandare
  5. Project : Bing Subdomain Scanner
  6. Thanks : all islamic
  7. #MaRocco hackers Production
  8.  
  9. */
  10. //No Max Execution Time
  11. set_time_limit(0);
  12.  
  13. //Curl Function
  14. function curlreq($domain)
  15. {
  16. $curl = curl_init();
  17. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  18. curl_setopt($curl, CURLOPT_URL, $domain);
  19. $result = curl_exec($curl);
  20.  
  21. return $result;
  22. }
  23.  
  24. //Url Cleaning
  25. function cleanme($url)
  26. {
  27. if(preg_match("/^(http(?:s):\/\/)(www\.)?([^\/]+)/i",$url, $matches))
  28. {
  29. $host = $matches[3];
  30.  
  31. }
  32. else
  33. {
  34. $url = $url;
  35. preg_match("/^(www\.)?([^\/]+)/i",$url, $matches);
  36. $host = $matches[2];
  37. }
  38. return trim($host);
  39. }
  40.  
  41.  
  42. // Enter Domain Name http://google.co.ma
  43. if (isset($_POST['web'])) {
  44. $web = $_POST['web'];
  45.  
  46. $i = 1;
  47. $subdomains = array();
  48. while (true)
  49. {
  50.  
  51. $website = curlreq("http://www.bing.com/search?q=domain%3a".$web."&first=".$i);
  52. $searchme = '#<div class="sb_meta"><cite>(.*?)</cite>#si';
  53. preg_match_all($searchme, $website, $matches);
  54. array_push($subdomains, $matches[1]);
  55. if($i == 1)
  56. {
  57. $i = 11;
  58. }
  59. else
  60. {
  61. $i = $i +12;
  62. }
  63. if(!preg_match('/Next/',$website)){break;}
  64. }
  65.  
  66.  
  67. //print_r($subdomains);
  68. //get Unique Results
  69. array_unique($subdomains);
  70. sort($subdomains);
  71.  
  72. //Result
  73. echo "<textarea rows=\"10\" cols=\"50\">";
  74. $countotal = 1;
  75. foreach ($subdomains as $value)
  76. {
  77. foreach ($value as $name)
  78. {
  79. echo cleanme($name)."\n";
  80.  
  81. $countotal++;
  82. }
  83. }
  84. echo "</textarea><br>";
  85. echo "Number of Subdomains : $countotal";
  86. }
  87.  
  88. ?>
  89.  
  90. <html>
  91. <form method="POST" action="">
  92. <input name="web" type="text"> <br />
  93. <input type="submit" value="Scan!">
  94. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement