Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.59 KB | None | 0 0
  1. using PokemonGoAccountCreator.Database;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Net;
  7. using System.Net.Http;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10.  
  11. namespace PokemonGoAccountCreator
  12. {
  13. class AccountCreator
  14. {
  15. public AccountCreator(string name, string password, string email, string emailPassword)
  16. {
  17. this.Name = name;
  18. this.Password = password;
  19. this.Email = email;
  20. this.EmailPassword = emailPassword;
  21. CookieContainer cookies = new CookieContainer();
  22. HttpClientHandler handler = new HttpClientHandler();
  23. handler.AllowAutoRedirect = true;
  24. handler.CookieContainer = cookies;
  25. this.HttpClient = new HttpClient(handler);
  26. }
  27. HttpClient HttpClient
  28. {
  29. get;
  30. set;
  31. }
  32. public string Name
  33. {
  34. get;
  35. set;
  36. }
  37. string Password
  38. {
  39. get;
  40. set;
  41. }
  42. string Email
  43. {
  44. get;
  45. set;
  46. }
  47. public string EmailPassword { get; set; }
  48.  
  49. public async Task Start()
  50. {
  51. await Step1();
  52. }
  53. async Task Step1()
  54. {
  55. string page = "https://club.pokemon.com/uk/pokemon-trainer-club/sign-up/";
  56.  
  57. // ... Use HttpClient.
  58. using (HttpResponseMessage response = await HttpClient.GetAsync(page))
  59. using (HttpContent content = response.Content)
  60. {
  61. // ... Read the string.
  62. string result = await content.ReadAsStringAsync();
  63.  
  64. // Console.WriteLine("Step1 " + response.RequestMessage.RequestUri.ToString());
  65.  
  66. // System.IO.File.WriteAllText("output.txt", result);
  67. // ... Display the result.
  68. if (result != null &&
  69. result.Length >= 50)
  70. {
  71. //Console.WriteLine(result.Substring(0, 50) + "...");
  72. }
  73. if (result.Contains("With the exciting launch of Pokémon GO"))
  74. {
  75. Console.WriteLine("Server down");
  76. return;
  77. }
  78. string token = result.Substring(result.IndexOf("csrfmiddlewaretoken") + 28, 100);
  79. token = token.Substring(0, token.IndexOf("'"));
  80. Console.WriteLine("Token is " + token);
  81.  
  82. await PostDOB(token);
  83. }
  84. }
  85. async Task PostDOB(string token)
  86. {
  87. /*
  88. csrfmiddlewaretoken:i5EKzRBGqPbZkGx3ODXorsjF7ePypfF9
  89. dob:1994-06-05
  90. undefined:5
  91. undefined:1994
  92. country:GB
  93. country:GB*/
  94. var postContent = new FormUrlEncodedContent(new[]
  95. {
  96. new KeyValuePair<string, string>("csrfmiddlewaretoken", token),
  97. new KeyValuePair<string, string>("dob", "1994-06-05"),
  98. new KeyValuePair<string, string>("undefined", "5"),
  99. new KeyValuePair<string, string>("undefined", "1994"),
  100. new KeyValuePair<string, string>("country", "GB"),
  101. new KeyValuePair<string, string>("country", "GB"),
  102. });
  103. /*
  104. Host:club.pokemon.com
  105. Origin:https://club.pokemon.com
  106. Referer:https://club.pokemon.com/uk/pokemon-trainer-club/sign-up/
  107. Upgrade-Insecure-Requests:1
  108. User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
  109. */
  110. HttpClient.DefaultRequestHeaders.Add("Host", "club.pokemon.com");
  111. HttpClient.DefaultRequestHeaders.Add("Origin", "https://club.pokemon.com");
  112. HttpClient.DefaultRequestHeaders.Add("Referer", "https://club.pokemon.com/uk/pokemon-trainer-club/sign-up/");
  113. HttpClient.DefaultRequestHeaders.Add("Upgrade-Insecure-Requests", "1");
  114. HttpClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36");
  115. string page = "https://club.pokemon.com/uk/pokemon-trainer-club/sign-up/";
  116. using (HttpResponseMessage response = await HttpClient.PostAsync(page, postContent))
  117. using (HttpContent content = response.Content)
  118. {
  119. // ... Read the string.
  120. string result = await content.ReadAsStringAsync();
  121.  
  122. // Console.WriteLine("PostDOB " + response.RequestMessage.RequestUri.ToString());
  123.  
  124. // System.IO.File.WriteAllText("postdobresult.html", result);
  125. // ... Display the result.
  126. if (result != null && result.Length >= 50)
  127. {
  128. // Console.WriteLine(result.Substring(0, 50) + "...");
  129. }
  130. if (result.Contains("With the exciting launch of Pokémon GO"))
  131. {
  132. Console.WriteLine("Server down PostDOB");
  133. return;
  134. }
  135.  
  136. await PostOtherDetails(token);
  137. }
  138. }
  139. async Task PostOtherDetails(string token)
  140. {
  141. var postContent = new FormUrlEncodedContent(new[]
  142. {
  143. new KeyValuePair<string, string>("csrfmiddlewaretoken", token),
  144. new KeyValuePair<string, string>("username", Name),
  145. new KeyValuePair<string, string>("password", Password),
  146. new KeyValuePair<string, string>("confirm_password", Password),
  147. new KeyValuePair<string, string>("email", Email),
  148. new KeyValuePair<string, string>("confirm_email", Email),
  149. new KeyValuePair<string, string>("public_profile_opt_in", $"True"),
  150. new KeyValuePair<string, string>("screen_name", Name),
  151. new KeyValuePair<string, string>("terms", "on"),
  152. });
  153. string page = "https://club.pokemon.com/uk/pokemon-trainer-club/parents/sign-up";
  154. using (HttpResponseMessage response = await HttpClient.PostAsync(page, postContent))
  155. using (HttpContent content = response.Content)
  156. {
  157. // ... Read the string.
  158. string result = await content.ReadAsStringAsync();
  159. // Console.WriteLine("PostOtherDetails " + response.RequestMessage.RequestUri.ToString());
  160. System.IO.File.WriteAllText("postotherdetails.html", result);
  161. // ... Display the result.
  162. if (result != null && result.Length >= 50)
  163. {
  164. // Console.WriteLine(result.Substring(0, 50) + "...");
  165. }
  166. if (result.Contains("With the exciting launch of Pokémon GO"))
  167. {
  168. Console.WriteLine("Server down PostDOB");
  169. return;
  170. }
  171. if (result.Contains("This email address is already associated with an account"))
  172. {
  173. Console.WriteLine($"{Email} already registered");
  174. return;
  175. }
  176. if (!result.Contains("Hello! Thank you for creating an account"))
  177. {
  178. System.IO.File.WriteAllText("failed_to_gen.html", result);
  179. Console.WriteLine("Failed to make the account");
  180. return;
  181. }
  182.  
  183. DBPokeAccount pokeAccount = new DBPokeAccount()
  184. {
  185. Email = Email,
  186. EmailPassword = EmailPassword,
  187. EmailVerified = false,
  188. Password = Password,
  189. TimeCreated = DateTime.UtcNow,
  190. Username = Name,
  191. Level = -1
  192. };
  193. PokeDBConnection dbConnection = new PokeDBConnection();
  194. await dbConnection.Insert(pokeAccount);
  195. await VerifyEmail();
  196. }
  197. }
  198. async Task VerifyEmail()
  199. {
  200. Console.WriteLine($"{Name} sleeping 45s");
  201. await Task.Delay(10000);
  202.  
  203. EmailManager manager = new EmailManager(Email, EmailPassword);
  204.  
  205. string page = await manager.GetVerificationURL();
  206. while (string.IsNullOrEmpty(page))
  207. {
  208. await Task.Delay(10000);
  209. page = await manager.GetVerificationURL();
  210. }
  211.  
  212.  
  213. while (true)
  214. {
  215. // ... Use HttpClient.
  216. using (HttpResponseMessage response = await HttpClient.GetAsync(page))
  217. using (HttpContent content = response.Content)
  218. {
  219. // ... Read the string.
  220. string result = await content.ReadAsStringAsync();
  221. // System.IO.File.WriteAllText("verify.html", result);
  222. if (result.Contains("Your account is now active") || result.Contains("Your account has already been activated."))
  223. {
  224. break;
  225. }
  226. Console.WriteLine("Failed to verify, trying again in 3 seconds");
  227. await Task.Delay(3000);
  228. }
  229. }
  230.  
  231. Console.WriteLine(Name + " created!");
  232.  
  233.  
  234. PokeDBConnection dbConnection = new PokeDBConnection();
  235. DBPokeAccount pokeAccount = await dbConnection.GetAccountByUsername(Name);
  236. pokeAccount.EmailVerified = true;
  237.  
  238. await dbConnection.Update(pokeAccount);
  239.  
  240. string text = $"\"{Name}\",";
  241. using(StreamWriter stream = File.AppendText("output/made.txt"))
  242. {
  243. stream.WriteLine(text);
  244. }
  245.  
  246. GeneratedAccountJSON json = new GeneratedAccountJSON()
  247. {
  248. Username = Name,
  249. Email = Email,
  250. EmailPassword = EmailPassword,
  251. Password = Password,
  252. TimeCreated = DateTime.UtcNow,
  253. };
  254. string serialized = Newtonsoft.Json.JsonConvert.SerializeObject(json);
  255. System.IO.File.WriteAllText($"accounts/{Name}.json", serialized);
  256. }
  257.  
  258. public async static Task<bool> IsUsernameInUse(string name)
  259. {
  260. Console.WriteLine("checking " + name);
  261. var postContent = new FormUrlEncodedContent(new[]
  262. {
  263. new KeyValuePair<string, string>("name", name),
  264. });
  265. HttpClient httpClient = new HttpClient();
  266. string page = "https://club.pokemon.com/api/signup/verify-username";
  267. try
  268. {
  269. using (HttpResponseMessage response = await httpClient.PostAsync(page, postContent))
  270. using (HttpContent content = response.Content)
  271. {
  272. // ... Read the string.
  273. string result = await content.ReadAsStringAsync();
  274. // System.IO.File.WriteAllText("Verify.txt", result);
  275.  
  276. //{"valid":true,"suggestions":["Josh94926332","Josh94330968","Josh94739209"],"inuse":true}
  277. var dyn = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(result);
  278. return dyn.inuse;
  279. }
  280. }
  281. catch (Exception ex)
  282. {
  283. Console.WriteLine(ex.Message);
  284. return true;
  285. }
  286. }
  287. }
  288. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement