Advertisement
mattbarrah

Untitled

Oct 1st, 2011
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.96 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.     I removed the other cookies from this portion of the script, https://website/CookieAuth.dll?GetLogon?curl=Z2FPagesZ2Fschedule.aspx&reason=2&formdir=9 does not set any upon the first visit.  I would assume they were left over from a previous session.
  5. */
  6. $ch = curl_init();
  7.  
  8. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  9. curl_setopt($ch, CURLOPT_HEADER, 1);
  10. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  11. curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
  12. curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
  13.  
  14. curl_setopt($ch, CURLOPT_URL, "https://website/CookieAuth.dll?Logon");
  15. curl_setopt($ch, CURLOPT_POST, true);
  16.  
  17. $useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
  18. curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
  19.  
  20. $data = array(
  21.     'username' => 'test',
  22.     'password' => 'test',
  23.     'curl' => 'Z2FPagesZ2Fschedule.aspx',
  24.     'flags' => '0',
  25.     'forcedownlevel' => '0',
  26.     'formdir' => '9',
  27.     'trusted' => '0',
  28.     'SubmitCreds' => 'Log On'
  29. );
  30.  
  31. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
  32. $output = curl_exec($ch);
  33.  
  34. print_r($output);
  35.  
  36. /*
  37. Response:
  38.  
  39. HTTP/1.1 302 Moved Temporarily
  40. Location: https://website/Pages/schedule.aspx
  41. Set-Cookie: cadataF91BF9412BC9459AA2FC649721433C28="0cda9a35c-7777-46e1-be68-55475880a284KglOJh0EX2CMqruImGA1XMiSkXQLrOVBMGSHSszFMugcbfuNN3vOz7AjUw1ul7iI9KSZbTDGFU7iUHzwq4zqG9VAQmLCIEejQR60MInt6/M="; HttpOnly; Domain=website; secure; path=/
  42. Content-Length: 0
  43. Connection: close
  44.  
  45. HTTP/1.1 302 Moved Temporarily
  46. Location: https://website/CookieAuth.dll?GetLogon?curl=Z2FPagesZ2Fschedule.aspx&reason=2&formdir=9
  47. Set-Cookie: cadataF91BF9412BC9459AA2FC649721433C28=; Domain=website; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT
  48. Connection: close
  49. Content-Length: 0
  50.  
  51. HTTP/1.1 200 OK
  52. Connection: close
  53. Content-Length: 8341
  54. Content-Type: text/html
  55. Pragma: no-cache
  56. Cache-control: no-cache,max-age=0,must-revalidate
  57.  
  58. */
  59. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement