Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2016
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. <?php
  2. $admin_username = 'admin_42cebf16513c1898783d939b0afed141';
  3. $admin_password = '$6$rounds=10240$b2cdda324a52328c$30ZTp7tdJnmWC13wcF1OMCBKeA5Jk0ZILr9jIYdDUSudCGg20ktl3na72.9YSw19zoy56QcXlCmnJFJUDNzS1.';
  4.  
  5. if(isset($_POST['user'],$_POST['pass'])){
  6. if (check_user_login(trim($_POST['user']),trim($_POST['pass']))){
  7. include_once("flag.php");
  8. echo "<div class='alert alert-success' role='alert'><b>BAM:</b>" . $flag . "</div>";
  9. }
  10. }
  11.  
  12. function generate_password($password){
  13. return crypt($password, '$6$rounds=10240$'.md5(mt_rand()));
  14. }
  15.  
  16. function check_user_login($posted_username,$posted_password){
  17. global $admin_username, $admin_password;
  18.  
  19. if ($posted_username === $admin_username){
  20. if (crypt($posted_password, $admin_password) === $admin_password){
  21. return true;
  22. }
  23. } else {
  24. $tmp_pass = generate_password(time()); // copied code to prevent against timing attacks on username
  25. if (crypt($posted_password, $tmp_pass) === $tmp_pass){ // prevent brute forcing admin password from login form
  26. return true;
  27. }
  28. }
  29. return false;
  30. }
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement