Advertisement
dr-iman

Site Extractor

Jun 25th, 2017
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 4.33 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use LWP::UserAgent;
  4.  
  5. use HTTP::Request::Common qw(GET);
  6.  
  7. use WWW::Mechanize;  
  8.  
  9. use Socket;
  10.  
  11. $mech = WWW::Mechanize->new(autocheck => 0);
  12. $ag = LWP::UserAgent->new();
  13.  
  14. $ag->agent("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.3) Gecko/20010801");
  15.  
  16. $ag->timeout(10);
  17.  
  18. sub getSites {
  19.     for($count=10;$count<=1000;$count+=10)
  20.     {
  21.         $k++;
  22. #       $url = "http://www.hotbot.com/search/web?pn=$k&q=ip%3A$ip&keyvol=01f9093871a6d24c0d94";
  23.         $url = "https://www.bing.com/search?q=ip%3a$ip&go=Submit+Query&qs=ds&first=$count&FORM=PERE$k";
  24. #       $url = "https://www.bing.com/search?q=ip%3A$ip+&count=50&first=$count";
  25.         $resp = $ag->request(HTTP::Request->new(GET => $url));
  26.  
  27.         $rrs = $resp->content;
  28.  
  29.  
  30.  
  31.         while($rrs =~ m/<a href=\"?http:\/\/(.*?)\//g)
  32.         {
  33.    
  34.             $link = $1;
  35.        
  36.             if ( $link !~ /overture|msn|live|bing|yahoo|duckduckgo|google|yahoo|microsof/)
  37.             {
  38.                 if ($link !~ /^http:/)
  39.                 {
  40.                     $link = 'http://' . "$link" . '/';
  41.                 }
  42.    
  43.                 if($link !~ /\"|\?|\=|index\.php/)
  44.                 {
  45.                     if  (!  grep (/$link/,@result))
  46.                     {
  47.                         push(@result,$link);
  48.                     }
  49.                 }
  50.             }
  51.         }
  52.     }
  53.     $found = $#result + 1;
  54.     print "found $found sites\n";
  55.    
  56. }
  57. sub IP_id {
  58.     print "Enter The Ip of Server or Site Link\n";
  59.     print ">> ";
  60.     $input =<stdin>;
  61.     chomp($input);
  62.     if ($input =~ m/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/)
  63.     {
  64.         $ip = $input;
  65.         print "Pleast wait ... Getting WebSites...\n";
  66.         getSites();
  67.     }
  68.     elsif ($input =~ m/\D/g)
  69.     {
  70.         if ($input =~ m/https:\/\//)
  71.         {
  72.             $source = substr($input,8,length($input));
  73.             print "Site : $source\n";
  74.             print "Getting IP Adress...\n";
  75.                         $ip = inet_ntoa(inet_aton($source));
  76.                         print "IP: $ip\n";
  77.             print "Pleast wait ... Getting WebSites...\n";
  78.             getSites();
  79.         }
  80.                 elsif ($input =~ m/http:\/\//)
  81.                 {
  82.                         $source = substr($input,7,length($input));
  83.                         print "Site : $source\n";
  84.             print "Getting IP Adress...\n";
  85.                         $ip = inet_ntoa(inet_aton($source));
  86.                         print "IP: $ip\n";
  87.             print "Pleast wait ... Getting WebSites ...\n";
  88.             getSites();
  89.  
  90.                 }
  91.         else
  92.         {
  93.             print "Site : $input\n";
  94.             print "Getting IP Adress...\n";
  95.             $ip = inet_ntoa(inet_aton($input));
  96.             print "IP : $ip\n";
  97.             print "Pleast wait ... Getting WebSites...\n";
  98.             getSites();
  99.         }
  100.     }  
  101. }
  102. system(($^O eq 'MSWin32') ? 'cls' : 'clear');
  103. sub Into {
  104.     print qq(
  105.  _______  ___   _______  _______                                                  
  106. |       ||   | |       ||       |            ##############################                                      
  107. |  _____||   | |_     _||    ___|            # Tools By : DR.IMAN         #                            
  108. | |_____ |   |   |   |  |   |___             # Tel : DarkCod3r            #                        
  109. |_____  ||   |   |   |  |    ___|            # Site : Guardiran.org       #                              
  110.  _____| ||   |   |   |  |   |___             # Usage : Perl ext.pl        #                            
  111. |_______||___|   |___|  |_______|            ##############################                                      
  112.  _______  __   __  _______  ______    _______  _______  _______  _______  ______  
  113. |       ||  |_|  ||       ||    _ |  |   _   ||       ||       ||       ||    _ |  
  114. |    ___||       ||_     _||   | ||  |  |_|  ||       ||_     _||   _   ||   | ||  
  115. |   |___ |       |  |   |  |   |_||_ |       ||       |  |   |  |  | |  ||   |_||_
  116. |    ___| |     |   |   |  |    __  ||       ||      _|  |   |  |  |_|  ||    __  |
  117. |   |___ |   _   |  |   |  |   |  | ||   _   ||     |_   |   |  |       ||   |  | |
  118. |_______||__| |__|  |___|  |___|  |_||__| |__||_______|  |___|  |_______||___|  |_|
  119.  
  120. );
  121.  
  122.  
  123.     print "\t\t\t    # Enter All For Get All WebSites : ";
  124.     $choice1 = <stdin>;
  125.     chomp ($choice1);
  126.     if ($choice1 eq "all" or $choice1 eq "ALL" or $choice1 eq "4")
  127.     {
  128.         print "\nExtract Server sites\n";
  129.         print "========================\n";
  130.         IP_id();
  131.         map {$_ = "$_\n"} (@result);
  132.         print @result;
  133.         print "Do you want to save the result (Y or N): ";
  134.         $save = <stdin>;
  135.         chomp($save);
  136.         if ($save eq "Y" or $save eq "" or $save eq "y")
  137.         {
  138.             open(sites, ">Result.txt");
  139.             print sites @result;
  140.             print "\t>> Saved at Result.txt\n";
  141.         }
  142.  
  143.     }
  144. }
  145. Into();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement