Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using PokemonGoAccountCreator.Database;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Net;
- using System.Net.Http;
- using System.Text;
- using System.Threading.Tasks;
- namespace PokemonGoAccountCreator
- {
- class AccountCreator
- {
- public AccountCreator(string name, string password, string email, string emailPassword)
- {
- this.Name = name;
- this.Password = password;
- this.Email = email;
- this.EmailPassword = emailPassword;
- CookieContainer cookies = new CookieContainer();
- HttpClientHandler handler = new HttpClientHandler();
- handler.AllowAutoRedirect = true;
- handler.CookieContainer = cookies;
- this.HttpClient = new HttpClient(handler);
- }
- HttpClient HttpClient
- {
- get;
- set;
- }
- public string Name
- {
- get;
- set;
- }
- string Password
- {
- get;
- set;
- }
- string Email
- {
- get;
- set;
- }
- public string EmailPassword { get; set; }
- public async Task Start()
- {
- await Step1();
- }
- async Task Step1()
- {
- string page = "https://club.pokemon.com/uk/pokemon-trainer-club/sign-up/";
- // ... Use HttpClient.
- using (HttpResponseMessage response = await HttpClient.GetAsync(page))
- using (HttpContent content = response.Content)
- {
- // ... Read the string.
- string result = await content.ReadAsStringAsync();
- // Console.WriteLine("Step1 " + response.RequestMessage.RequestUri.ToString());
- // System.IO.File.WriteAllText("output.txt", result);
- // ... Display the result.
- if (result != null &&
- result.Length >= 50)
- {
- //Console.WriteLine(result.Substring(0, 50) + "...");
- }
- if (result.Contains("With the exciting launch of Pokémon GO"))
- {
- Console.WriteLine("Server down");
- return;
- }
- string token = result.Substring(result.IndexOf("csrfmiddlewaretoken") + 28, 100);
- token = token.Substring(0, token.IndexOf("'"));
- Console.WriteLine("Token is " + token);
- await PostDOB(token);
- }
- }
- async Task PostDOB(string token)
- {
- /*
- csrfmiddlewaretoken:i5EKzRBGqPbZkGx3ODXorsjF7ePypfF9
- dob:1994-06-05
- undefined:5
- undefined:1994
- country:GB
- country:GB*/
- var postContent = new FormUrlEncodedContent(new[]
- {
- new KeyValuePair<string, string>("csrfmiddlewaretoken", token),
- new KeyValuePair<string, string>("dob", "1994-06-05"),
- new KeyValuePair<string, string>("undefined", "5"),
- new KeyValuePair<string, string>("undefined", "1994"),
- new KeyValuePair<string, string>("country", "GB"),
- new KeyValuePair<string, string>("country", "GB"),
- });
- /*
- Host:club.pokemon.com
- Origin:https://club.pokemon.com
- Referer:https://club.pokemon.com/uk/pokemon-trainer-club/sign-up/
- Upgrade-Insecure-Requests:1
- User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
- */
- HttpClient.DefaultRequestHeaders.Add("Host", "club.pokemon.com");
- HttpClient.DefaultRequestHeaders.Add("Origin", "https://club.pokemon.com");
- HttpClient.DefaultRequestHeaders.Add("Referer", "https://club.pokemon.com/uk/pokemon-trainer-club/sign-up/");
- HttpClient.DefaultRequestHeaders.Add("Upgrade-Insecure-Requests", "1");
- 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");
- string page = "https://club.pokemon.com/uk/pokemon-trainer-club/sign-up/";
- using (HttpResponseMessage response = await HttpClient.PostAsync(page, postContent))
- using (HttpContent content = response.Content)
- {
- // ... Read the string.
- string result = await content.ReadAsStringAsync();
- // Console.WriteLine("PostDOB " + response.RequestMessage.RequestUri.ToString());
- // System.IO.File.WriteAllText("postdobresult.html", result);
- // ... Display the result.
- if (result != null && result.Length >= 50)
- {
- // Console.WriteLine(result.Substring(0, 50) + "...");
- }
- if (result.Contains("With the exciting launch of Pokémon GO"))
- {
- Console.WriteLine("Server down PostDOB");
- return;
- }
- await PostOtherDetails(token);
- }
- }
- async Task PostOtherDetails(string token)
- {
- var postContent = new FormUrlEncodedContent(new[]
- {
- new KeyValuePair<string, string>("csrfmiddlewaretoken", token),
- new KeyValuePair<string, string>("username", Name),
- new KeyValuePair<string, string>("password", Password),
- new KeyValuePair<string, string>("confirm_password", Password),
- new KeyValuePair<string, string>("email", Email),
- new KeyValuePair<string, string>("confirm_email", Email),
- new KeyValuePair<string, string>("public_profile_opt_in", $"True"),
- new KeyValuePair<string, string>("screen_name", Name),
- new KeyValuePair<string, string>("terms", "on"),
- });
- string page = "https://club.pokemon.com/uk/pokemon-trainer-club/parents/sign-up";
- using (HttpResponseMessage response = await HttpClient.PostAsync(page, postContent))
- using (HttpContent content = response.Content)
- {
- // ... Read the string.
- string result = await content.ReadAsStringAsync();
- // Console.WriteLine("PostOtherDetails " + response.RequestMessage.RequestUri.ToString());
- System.IO.File.WriteAllText("postotherdetails.html", result);
- // ... Display the result.
- if (result != null && result.Length >= 50)
- {
- // Console.WriteLine(result.Substring(0, 50) + "...");
- }
- if (result.Contains("With the exciting launch of Pokémon GO"))
- {
- Console.WriteLine("Server down PostDOB");
- return;
- }
- if (result.Contains("This email address is already associated with an account"))
- {
- Console.WriteLine($"{Email} already registered");
- return;
- }
- if (!result.Contains("Hello! Thank you for creating an account"))
- {
- System.IO.File.WriteAllText("failed_to_gen.html", result);
- Console.WriteLine("Failed to make the account");
- return;
- }
- DBPokeAccount pokeAccount = new DBPokeAccount()
- {
- Email = Email,
- EmailPassword = EmailPassword,
- EmailVerified = false,
- Password = Password,
- TimeCreated = DateTime.UtcNow,
- Username = Name,
- Level = -1
- };
- PokeDBConnection dbConnection = new PokeDBConnection();
- await dbConnection.Insert(pokeAccount);
- await VerifyEmail();
- }
- }
- async Task VerifyEmail()
- {
- Console.WriteLine($"{Name} sleeping 45s");
- await Task.Delay(10000);
- EmailManager manager = new EmailManager(Email, EmailPassword);
- string page = await manager.GetVerificationURL();
- while (string.IsNullOrEmpty(page))
- {
- await Task.Delay(10000);
- page = await manager.GetVerificationURL();
- }
- while (true)
- {
- // ... Use HttpClient.
- using (HttpResponseMessage response = await HttpClient.GetAsync(page))
- using (HttpContent content = response.Content)
- {
- // ... Read the string.
- string result = await content.ReadAsStringAsync();
- // System.IO.File.WriteAllText("verify.html", result);
- if (result.Contains("Your account is now active") || result.Contains("Your account has already been activated."))
- {
- break;
- }
- Console.WriteLine("Failed to verify, trying again in 3 seconds");
- await Task.Delay(3000);
- }
- }
- Console.WriteLine(Name + " created!");
- PokeDBConnection dbConnection = new PokeDBConnection();
- DBPokeAccount pokeAccount = await dbConnection.GetAccountByUsername(Name);
- pokeAccount.EmailVerified = true;
- await dbConnection.Update(pokeAccount);
- string text = $"\"{Name}\",";
- using(StreamWriter stream = File.AppendText("output/made.txt"))
- {
- stream.WriteLine(text);
- }
- GeneratedAccountJSON json = new GeneratedAccountJSON()
- {
- Username = Name,
- Email = Email,
- EmailPassword = EmailPassword,
- Password = Password,
- TimeCreated = DateTime.UtcNow,
- };
- string serialized = Newtonsoft.Json.JsonConvert.SerializeObject(json);
- System.IO.File.WriteAllText($"accounts/{Name}.json", serialized);
- }
- public async static Task<bool> IsUsernameInUse(string name)
- {
- Console.WriteLine("checking " + name);
- var postContent = new FormUrlEncodedContent(new[]
- {
- new KeyValuePair<string, string>("name", name),
- });
- HttpClient httpClient = new HttpClient();
- string page = "https://club.pokemon.com/api/signup/verify-username";
- try
- {
- using (HttpResponseMessage response = await httpClient.PostAsync(page, postContent))
- using (HttpContent content = response.Content)
- {
- // ... Read the string.
- string result = await content.ReadAsStringAsync();
- // System.IO.File.WriteAllText("Verify.txt", result);
- //{"valid":true,"suggestions":["Josh94926332","Josh94330968","Josh94739209"],"inuse":true}
- var dyn = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(result);
- return dyn.inuse;
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.Message);
- return true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement