Advertisement
zucxk

Subdomain Finder

Aug 25th, 2018
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.20 KB | None | 0 0
  1. <?php
  2. set_time_limit(0);
  3.  
  4. $domain = $_GET['domain'];
  5.  
  6. function curl($url, $post=null) {
  7.     $ch = curl_init($url);
  8.     curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.3; rv:50.0) Gecko/20100101 Firefox/50.0");
  9.     if($post != null) {
  10.         curl_setopt($ch, CURLOPT_POST, true);
  11.         curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  12.     }
  13.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  14.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  15.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  16.     $exec = curl_exec($ch);
  17.     curl_close($ch);
  18.     return $exec;
  19. }
  20.  
  21. if(!empty($domain)) {
  22.     $find = curl("https://findsubdomains.com/subdomains-map/".$domain);
  23.     if(preg_match("/Page not found/i", $find)) exit("Domain tidak ditemukan!");
  24.     else{
  25.         preg_match("/var data = ([^']+);/i", $find, $data);
  26.         $data = explode("\n// create a name: node map", $data[1])[0];
  27.         $data = str_replace(array(" ",";"), "", $data);
  28.         $data = str_replace(",]", "]", $data);
  29.  
  30.         $json = json_decode($data);
  31.         foreach($json as $subdo) {
  32.             if($subdo->name !== "") echo $subdo->name."<br>";
  33.         }
  34.     }
  35. }else exit("Parameter domain masih kosong!");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement