Advertisement
dr-iman

Wp Websites Extractor

Jul 5th, 2017
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 5.87 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 WPS {
  58.     foreach $site (@result)
  59.     {
  60.         $url = $mech->get("$site");
  61.         $Scont = $mech->content;
  62.         if ($Scont =~ m/wp-content/g)
  63.         {
  64.             $license = $site."license.txt";
  65.             $horse = $mech->get("$license");
  66.             if ($horse->is_success)
  67.             {
  68.                 $Scont = $mech->content;
  69.                 $login = $site."wp-login.php";
  70.                 $logUrl = $mech->get("$login");
  71.                         if ($Scont =~ m/WordPress/)    
  72.                 {
  73.                     push @WPS,$site;
  74.                     print "$site\n";
  75.                 }
  76.                 elsif($logUrl->is_success)
  77.                 {
  78.                     push @WPS,$site;
  79.                     print "$site\n";
  80.                 }
  81.  
  82.             }
  83.  
  84.         }
  85.  
  86.  
  87.     }
  88.  
  89. }
  90. sub IP_id {
  91.     print "Enter the IP of the server or a site hosted on the same server\n";
  92.     print ">> ";
  93.     $input =<stdin>;
  94.     chomp($input);
  95.     if ($input =~ m/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/)
  96.     {
  97.         $ip = $input;
  98.         print "Searching The WebSites...\n";
  99.         getSites();
  100.     }
  101.     elsif ($input =~ m/\D/g)
  102.     {
  103.         if ($input =~ m/https:\/\//)
  104.         {
  105.             $source = substr($input,8,length($input));
  106.             print "Site : $source\n";
  107.             print "Get IP Adress...\n";
  108.                         $ip = inet_ntoa(inet_aton($source));
  109.                         print "IP: $ip\n";
  110.             print "Searching The WebSites...\n";
  111.             getSites();
  112.         }
  113.                 elsif ($input =~ m/http:\/\//)
  114.                 {
  115.                         $source = substr($input,7,length($input));
  116.                         print "Site : $source\n";
  117.             print "Gett IP Adress...\n";
  118.                         $ip = inet_ntoa(inet_aton($source));
  119.                         print "IP: $ip\n";
  120.             print "Searching The WebSites...\n";
  121.             getSites();
  122.  
  123.                 }
  124.         else
  125.         {
  126.             print "Site : $input\n";
  127.             print "Get IP Adress...\n";
  128.             $ip = inet_ntoa(inet_aton($input));
  129.             print "IP : $ip\n";
  130.             print "Searching The WebSites...\n";
  131.             getSites();
  132.         }
  133.     }  
  134. }
  135. system(($^O eq 'MSWin32') ? 'cls' : 'clear');
  136. sub Into {
  137.     print qq(
  138.                                                                                                                            
  139.                                                                                                                            
  140. M""MMM""MMM""M             M""MMM""MMM""M          dP                oo   dP                    
  141. M  MMM  MMM  M             M  MMM  MMM  M          88                     88                    
  142. M  MMP  MMP  M 88d888b.    M  MMP  MMP  M .d8888b. 88d888b. .d8888b. dP d8888P .d8888b. .d8888b.
  143. M  MM'  MM' .M 88'  `88    M  MM'  MM' .M 88ooood8 88'  `88 Y8ooooo. 88   88   88ooood8 Y8ooooo.
  144. M  `' . '' .MM 88.  .88    M  `' . '' .MM 88.  ... 88.  .88       88 88   88   88.  ...       88
  145. M    .d  .dMMM 88Y888P'    M    .d  .dMMM `88888P' 88Y8888' `88888P' dP   dP   `88888P' `88888P'
  146. MMMMMMMMMMMMMM 88          MMMMMMMMMMMMMM                                                        
  147.               dP                                                                                
  148. MM""""""""`M            dP                                dP                                    
  149. MM  mmmmmmmM            88                                88                                    
  150. M`      MMMM dP.  .dP d8888P 88d888b. .d8888b. .d8888b. d8888P .d8888b. 88d888b.                
  151. MM  MMMMMMMM  `8bd8'    88   88'  `88 88'  `88 88'  `""   88   88'  `88 88'  `88                
  152. MM  MMMMMMMM  .d88b.    88   88       88.  .88 88.  ...   88   88.  .88 88                      
  153. MM        .M dP'  `dP   dP   dP       `88888P8 `88888P'   dP   `88888P' dP                      
  154. MMMMMMMMMMMM                                                                                                                                                                                                                                                                                                                          
  155.                                                                            Coded By : DR-IMAN
  156.                                                                            Guardiran Security Team ( Guardiran.org )
  157.                                                                                                  
  158.                                                                                                  
  159. );
  160.  
  161.  
  162.     print "\t\t\t    # Enter wp To Get Wordpress WebSites : ";
  163.         $choice1 = <stdin>;
  164.     chomp ($choice1);
  165.     if ($choice1 eq "wp" or $choice1 eq "WP")
  166.     {
  167.         print "\nExtract Wp WebSites...\n";
  168.         print "****************************\n";
  169.         IP_id();
  170.         print "Searching for Wordpress WebSites\n";
  171.         WPS();
  172.         $n_found = $#WPS+1;
  173.         print "\t>> Found $n_found Wordpress sites\n\n";
  174.         print "Save The Scan Result? (Y\\n): ";
  175.         $save = <stdin>;
  176.         chomp($save);
  177.         if ($save eq "Y" or $save eq "" or $save eq "y")
  178.         {
  179.             open(wp, ">WP.txt");
  180.             map {$_ = "$_\n"} (@WPS);
  181.             print wp @WPS;
  182.         print "\t>> Saved at WP.txt\n";
  183.         }
  184.  
  185.     }
  186. }
  187. Into();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement