Guest User

Untitled

a guest
May 24th, 2018
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. class Program
  2. {
  3. static void Main(string[] args)
  4. {
  5.  
  6. string viewstateid = "/wEPDwUKLTY3NjEyMzE4NWRkK4DxZpjTmZg/RGCS2s13vkEWmwWiEE6v+XrYoWVuxeg=";
  7. string eventid ="/wEdAAoSjOGPZYAAeKGjkZOhQ+aKHfOfr91+YI2XVhP1c/pGR96FYSfo5JULYVvfQ61/Uw4pNGL67qcLo0vAZTfi8zd7jfuWZzOhk6V/gFA/hhJU2fx7PQKw+iST15SoB1LqJ4UpaL7786dp6laCBt9ubQNrfzeO+rrTK8MaO2KNxeFaDhrQ0hxxv9lBZnM1SHtoODXsNUYlOeO/kawcn9fX0BpWN7Brh7U3BIQTZwMNkOzIy+rv+Sj8XkEEA9HaBwlaEjg=";
  8.  
  9. string username = "user1";
  10. string password = "ttee";
  11.  
  12. string loginbutton = "Log In";
  13.  
  14. string URLAuth = "http://localhost/login.aspx";
  15. string postString = string.Format("VIEWSTATE={0}&EVENTVALIDATION={1}&LoginUser_UserName={2}&LoginUser_Password={3}&LoginUser_LoginButton={4}",viewstateid,eventid, username, password,realm,otp,loginbutton);
  16.  
  17. const string contentType = "application/x-www-form-urlencoded";
  18. System.Net.ServicePointManager.Expect100Continue = false;
  19.  
  20. CookieContainer cookies = new CookieContainer();
  21. HttpWebRequest webRequest = WebRequest.Create(URLAuth) as HttpWebRequest;
  22. webRequest.Method = "POST";
  23. webRequest.ContentType = contentType;
  24. webRequest.CookieContainer = cookies;
  25. webRequest.ContentLength = postString.Length;
  26. webRequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1";
  27. webRequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
  28.  
  29. webRequest.Referer = "http://localhost/login.aspx";
  30.  
  31. StreamWriter requestWriter = new StreamWriter(webRequest.GetRequestStream());
  32. requestWriter.Write(postString);
  33. requestWriter.Close();
  34.  
  35. StreamReader responseReader = new StreamReader(webRequest.GetResponse().GetResponseStream());
  36. string responseData = responseReader.ReadToEnd();
  37. Console.WriteLine(responseData);
  38. responseReader.Close();
  39. webRequest.GetResponse().Close();
  40.  
  41. }
  42. }
  43.  
  44. curl --data "post1=value1&post2=value2&etc=valetc" http://host/resource
  45.  
  46. curl -X POST -d @file http://host/resource
  47.  
  48. http://localhost/library/book/34
  49.  
  50. POST library/book/34 HTTP/1.0rn
  51. X-Requested-With: XMLHttpRequestrn
  52. Content-Type: text/htmlrn
  53. Referer: localhostrn
  54. Content-length: 36rnrn
  55. title=Learning+REST&author=Some+Name
  56.  
  57. DATA="foo=bar&baz=qux"
  58. curl --data "$DATA" --request POST --header "Content-Type:application/x-www-form-urlencoded" http://example.com/api/callback | python -m json.tool
  59.  
  60. exec 3<> /dev/tcp/example.com/80
  61.  
  62. DATA='{"email": "foo@example.com"}'
  63. LEN=$(printf "$DATA" | wc -c)
  64.  
  65. cat >&3 << EOF
  66. POST /api/retrieveInfo HTTP/1.1
  67. Host: example.com
  68. User-Agent: Bash
  69. Accept: */*
  70. Content-Type:application/json
  71. Content-Length: $LEN
  72. Connection: close
  73.  
  74. $DATA
  75. EOF
  76.  
  77. # Read response.
  78. while read line <&3; do
  79. echo $line
  80. done
  81.  
  82. curl -X POST -A 'Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0' -d "field=acaca&name=afadxx" https://example.com
Add Comment
Please, Sign In to add comment