Advertisement
kaiux

WPScanner

Aug 17th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.96 KB | None | 0 0
  1. #install first
  2. #sudo apt-get install libmojolicious-perl
  3.  
  4.  
  5. #!/usr/bin/perl
  6. #@kaiux
  7. use Mojo::UserAgent;
  8. use strict;
  9. use warnings;
  10. use feature 'say';
  11.  
  12. binmode(STDOUT, ":utf8");
  13.  
  14. sub scan_wp {
  15.    my ($protocol, $domain, $pattern) = @_;
  16.  
  17.    my $ua = Mojo::UserAgent->new;
  18.    my $url = $protocol."://".$domain."/".$pattern;
  19.    say "Querying for $url";
  20.    my $html = $ua->get($url);
  21.    my $code = $html->res->code;
  22.  
  23.    if ( $code eq "200" ) {
  24.       say "Found WP in $domain";
  25.    } elsif ( ($code eq "301") or ($code eq "302") ) {
  26.       my $redirect = $html->res->headers->location;
  27.  
  28.       if ( $redirect =~ /reauth=1/m ) {
  29.      say "Found WP and got a redirect :P";
  30.       }
  31.  
  32.       if ( $redirect =~ $pattern ) {
  33.      say "Found WP in $domain";
  34.       }
  35.  
  36.    } else {
  37.       say "Not a WP";
  38.    }
  39.  
  40. }
  41.  
  42. sub usage {
  43.    say "run http|https domain|ip wp-admin|wp-login";
  44.    exit 0;
  45. }
  46.  
  47. die usage if ( scalar @ARGV != 3 );
  48. scan_wp($ARGV[0], $ARGV[1], $ARGV[2]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement