Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2012
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Net;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Drawing;
  9. using System.Windows.Forms;
  10. using System.IO;
  11. using System.Diagnostics;
  12. using System.Web;
  13.  
  14.  
  15. namespace VoteBot
  16. {
  17. class Votifier
  18. {
  19.  
  20. public static void Main()
  21. {
  22. Logger(Post("http://icraftsmp.net/premiumshop/scripts/login-script.php", "Username=olimoli123&Password=oi212134143212121"));
  23.  
  24. }
  25.  
  26. public static string Post(string url, string data)
  27. {
  28.  
  29. string vystup = null;
  30. try
  31. {
  32. //Our postvars
  33. byte[] buffer = Encoding.ASCII.GetBytes(data);
  34. //Initialisation, we use localhost, change if appliable
  35. HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(url);
  36. //Our method is post, otherwise the buffer (postvars) would be useless
  37. WebReq.Method = "POST";
  38. //We use form contentType, for the postvars.
  39. WebReq.ContentType = "application/x-www-form-urlencoded";
  40. //The length of the buffer (postvars) is used as contentlength.
  41. WebReq.ContentLength = buffer.Length;
  42. //We open a stream for writing the postvars
  43. Stream PostData = WebReq.GetRequestStream();
  44. //Now we write, and afterwards, we close. Closing is always important!
  45. PostData.Write(buffer, 0, buffer.Length);
  46. PostData.Close();
  47. //Get the response handle, we have no true response yet!
  48. HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
  49. //Let's show some information about the response
  50. Console.WriteLine(WebResp.StatusCode);
  51. Console.WriteLine(WebResp.Server);
  52.  
  53. //Now, we read the response (the string), and output it.
  54. Stream Answer = WebResp.GetResponseStream();
  55. StreamReader _Answer = new StreamReader(Answer);
  56. vystup = _Answer.ReadToEnd();
  57. MessageBox.Show(WebResp.StatusDescription);
  58. //Congratulations, you just requested your first POST page, you
  59. //can now start logging into most login forms, with your application
  60. //Or other examples.
  61. }
  62. catch (Exception ex)
  63. {
  64. MessageBox.Show(ex.Message);
  65. }
  66. return vystup.Trim() + "\n";
  67.  
  68. }
  69. public static string Logger(string LogThis)
  70. {
  71. string vystup = null;
  72. try
  73. {
  74. // Create a writer and open the file:
  75. StreamWriter log;
  76.  
  77. if (!File.Exists("logfile.txt"))
  78. {
  79. log = new StreamWriter("logfile.txt");
  80. }
  81. else
  82. {
  83. log = File.AppendText("logfile.txt");
  84. }
  85. // Write to the file:
  86. log.WriteLine(DateTime.Now);
  87. log.WriteLine(LogThis);
  88. log.WriteLine();
  89.  
  90. // Close the stream:
  91. log.Close();
  92. }
  93. catch (NullReferenceException ex)
  94. {
  95. MessageBox.Show(ex.Message);
  96. }
  97. return vystup;
  98. }
  99.  
  100. }
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement