Advertisement
ecchiexploit

Subdomain Scanner V2

Jan 9th, 2021
1,779
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.07 KB | None | 0 0
  1. <?php
  2. function curl($url)
  3. {
  4.     $setopt = array(
  5.         CURLOPT_URL => 'https://osint.sh/subdomain/',
  6.         CURLOPT_RETURNTRANSFER => true,
  7.         CURLOPT_POST => true,
  8.         CURLOPT_POSTFIELDS => "domain=$url",
  9.         CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36',
  10.         CURLOPT_TIMEOUT => 60,
  11.         CURLOPT_CONNECTTIMEOUT => 60
  12.     );
  13.     $ch = curl_init();
  14.     curl_setopt_array($ch, $setopt);
  15.     $exe = curl_exec($ch);
  16.     curl_close($ch);
  17.     return $exe;
  18. }
  19. $domain = readline("Domain : ");
  20. if (!empty($domain))
  21. {
  22.     $subdomain = curl($domain);
  23.     $scrap = preg_match_all("/<a href=\"(.*?)\" target=\"_blank\">www.(.*?)<\/a>/i", $subdomain, $subdo);
  24.     echo "\nResult : \n";
  25.     for ($i = 0; $i < count($subdo[2]); $i++)
  26.     {
  27.         echo "[+] ".$subdo[2][$i]."\n";
  28.         $result = fopen('result.txt', "a+");
  29.         fwrite($result, $subdo[2][$i]."\n");
  30.         fclose($result);
  31.     }
  32.     echo "\nTotal All Subdomain In Domain $domain : ".count($subdo[2]);
  33. }
  34. else
  35. {
  36.     echo "Domain Empty!!";
  37. }
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement