Guest User

Untitled

a guest
Nov 23rd, 2018
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.78 KB | None | 0 0
  1. <?php
  2.  
  3. array_shift($argv);
  4.  
  5. foreach($argv as $key => $value) {
  6. $param = explode("=", trim(str_replace(",", "", $value)));
  7. $$param[0] = $param[1];
  8. echo "$param[0] = $param[1]\n";
  9. }
  10.  
  11. if(empty($username)) {
  12. echo "Please enter the username: ";
  13. $username = trim(fgets(STDIN));
  14. }
  15.  
  16. if(empty($password)) {
  17. echo "Please enter the password: ";
  18. $password = trim(fgets(STDIN));
  19. }
  20.  
  21. if(empty($realm)) {
  22. echo "Please enter the realm: ";
  23. $realm = trim(fgets(STDIN));
  24. }
  25.  
  26. if(empty($nonce)) {
  27. echo "Please enter the nonce: ";
  28. $nonce = trim(fgets(STDIN));
  29. }
  30.  
  31. if(empty($uri)) {
  32. echo "Please enter the uri: ";
  33. $uri = trim(fgets(STDIN));
  34. }
  35.  
  36. if(empty($qop)) {
  37. echo "Please enter the qop: ";
  38. $qop = trim(fgets(STDIN));
  39. }
  40.  
  41. if(empty($method)) {
  42. echo "Please enter the method: ";
  43. $method = strtoupper(trim(fgets(STDIN)));
  44. }
  45.  
  46. $HA1 = md5("$username:$realm:$password");
  47. $HA2 = md5("$method:$uri");
  48.  
  49. if ($qop == "auth") {
  50.  
  51. if(empty($cnonce)) {
  52. echo "Please enter the client nonce: ";
  53. $cnonce = trim(fgets(STDIN));
  54. }
  55.  
  56. if(empty($nc)) {
  57. echo "Please enter the nonce count: ";
  58. $nc = trim(fgets(STDIN));
  59. }
  60.  
  61. echo "Response ($qop): " .md5("$HA1:$nonce:$nc:$cnonce:$qop:$HA2") ."\n";
  62.  
  63. } else {
  64. echo "Response (unknown): " .md5("$HA1:$nonce:$HA2") ."\n";
  65. }
Add Comment
Please, Sign In to add comment