Advertisement
Guest User

DirectAdmin login attempt

a guest
Feb 17th, 2011
653
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.21 KB | None | 0 0
  1. /*
  2. LIVE HTTP HEADER of LOGIN DirectAdmin
  3.  
  4. http://213.000.000.000:2222/CMD_LOGIN
  5.  
  6. POST /CMD_LOGIN HTTP/1.1
  7. Host: 213.000.000.000:2222
  8. User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; nl; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
  9. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  10. Accept-Language: nl,en-us;q=0.7,en;q=0.3
  11. Accept-Encoding: gzip,deflate
  12. Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  13. Keep-Alive: 115
  14. Connection: keep-alive
  15. Referer: http://213.000.000.000:2222/CMD_LOGIN
  16. Cookie: session=
  17. Content-Type: application/x-www-form-urlencoded
  18. Content-Length: 56
  19. referer=%2FCMD_LOGIN&username=XXXXXX&password=XXXXXX
  20. HTTP/1.1 302 Found
  21. Server: DirectAdmin Daemon v1.37.0 Registered to XXXXXXXX.nl
  22. Set-Cookie: session=XXXXXXXXXXXXXXXXXXXXXX; path=/; HttpOnly
  23. Location: http://213.000.000.000:2222/
  24. Content-Type: text/html
  25. ----------------------------------------------------------
  26. http://213.000.000.000:2222/
  27.  
  28. GET / HTTP/1.1
  29. Host: 213.000.000.000:2222
  30. User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; nl; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
  31. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  32. Accept-Language: nl,en-us;q=0.7,en;q=0.3
  33. Accept-Encoding: gzip,deflate
  34. Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  35. Keep-Alive: 115
  36. Connection: keep-alive
  37. Referer: http://213.000.000.000:2222/CMD_LOGIN
  38. Cookie: session=XXXXXXXXXXX
  39.  
  40. HTTP/1.1 200 OK
  41. Server: DirectAdmin Daemon v1.37.0 Registered to XXXXXXXX.nl
  42. Connection: close
  43. Cache-Control: no-cache
  44. Pragma: no-cache
  45. Content-Type: text/html
  46. */
  47.  
  48. $ch = curl_init();
  49. $ckfile = tempnam ("/tmp", "CURLCOOKIE");
  50. curl_setopt($ch,CURLOPT_COOKIEJAR, $ckfile);
  51. curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
  52. curl_setopt($ch,CURLOPT_URL,$url);
  53. curl_setopt($ch,CURLOPT_POST,count($fields));
  54. curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
  55. $void = curl_exec($ch);
  56. // get file
  57. if($void!==false) {
  58.     $ch = curl_init();
  59.     curl_setopt($ch,CURLOPT_URL,$url);
  60.     curl_setopt($ch,CURLOPT_COOKIEFILE, $ckfile);
  61.     curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
  62.     $result = curl_exec($ch);
  63.     if($result===false) {
  64.         echo 'CURL ERROR: '.curl_error($ch);
  65.     }
  66. } else {
  67.     echo 'CURL ERROR: '.curl_error($ch);
  68. }
  69. curl_close($ch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement