Guest User

Untitled

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