コード例 #1
0
        public static async Task <AccountCreationResult> Create(AccountCreationOptions options)
        {
            var random = new TRandom();
            var client = new RestClient {
                Proxy = options.Proxy
            };

            var page = client.Execute(new RestRequest("https://club.pokemon.com/us/pokemon-trainer-club/sign-up/",
                                                      Method.GET));

            var csrf = string.Empty;

            // Get CSRF
            var match =
                new Regex("<input type='hidden' name='csrfmiddlewaretoken' value='(\\w+)' />").Match(page.Content);

            if (match.Success)
            {
                csrf = match.Groups[1].Value;
            }

            client.Execute(new RestRequest("https://club.pokemon.com/us/pokemon-trainer-club/sign-up/", Method.POST)
                           .AddParameter("csrfmiddlewaretoken", csrf)
                           .AddParameter("dob", options.Dob)
                           .AddParameter("country", "US")
                           .AddParameter("country", "US")
                           .AddParameter("picker__year", options.Dob.Split('-')[0])
                           .AddParameter("picker__month", options.Dob.Split('-')[1]));

            await Task.Delay(random.Next(2000, 3000));

            var user = client.Execute <VerifyUsernameResponse>(new RestRequest("https://club.pokemon.com/api/signup/" +
                                                                               "verify-username", Method.POST)
                                                               .AddJsonBody(new { name = options.Username })
                                                               .AddHeader("X-CSRFToken", csrf));

            // If username is in use, switch to a random suggestion from PTC
            if (user.Data.InUse)
            {
                options.Username = random.Choice(user.Data.Suggestions);
            }

            var captcha = options.CaptchaService.Solve();

            await Task.Delay(random.Next(1500, 2500));

            var res = client.Execute(new RestRequest("https://club.pokemon.com/us/pokemon-trainer-club/sign-up/", Method
                                                     .POST)
                                     .AddParameter("csrfmiddlewaretoken", csrf)
                                     .AddParameter("username", options.Username));

            return(new AccountCreationResult
            {
                Successful = res.StatusCode == HttpStatusCode.Found,
                Username = options.Username,
                Password = options.Password
            });
        }
コード例 #2
0
        public static async void Run(string[] args)
        {
            var           random = new TRandom();
            Configuration config;

            try
            {
                config = JsonConvert.DeserializeObject <Configuration>(File.ReadAllText(
                                                                           Directory.GetCurrentDirectory() + "/" +
                                                                           "config.json"));
            }
            catch (FileNotFoundException e)
            {
                Console.WriteLine("Please create a config.json file to continue.");
                throw;
            }
            Console.Write("Hello and welcome to ");
            Console.ForegroundColor = ConsoleColor.Magenta;
            Console.Write("Entropy!\n");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("How many accounts would you like to create today?");
            var acts = int.Parse(Console.ReadLine());

            Console.WriteLine($"This generation session will cost you about ${Math.Round(acts * 0.003, 2)} USD " +
                              $"(for {acts} accounts)");

            IProxyPool proxyPool;

            if (File.Exists($"{Directory.GetCurrentDirectory()}/{config.ProxyFile}"))
            {
                proxyPool = new StandardProxyPool(ProxyReader.ReadProxies(config.ProxyFile));
            }
            else
            {
                proxyPool = new GimmeProxyPool();
            }

            var captcha = new TwoCaptchaService(config.CaptchaKey);

            Console.WriteLine("OK! Let's go!");
            var tasks = new List <Task>();

            Status = "OK";
            UpdateStats();
            for (var i = acts - 1; i >= 0; i--)
            {
                tasks.Add(new Task(async() =>
                {
                    var proxy = proxyPool.NextProxy();
                    ActiveProxies++;
                    for (var x = 0; x < 5; x++)
                    {
                        var username = random.Choice(config.Usernames.Prefix) + random.Choice(config.Usernames.Root) +
                                       random.Choice(config.Usernames.Suffix);

                        var password = config.Password.UseStaticPassword ? config.Password.StaticPassword : String.Empty;

                        var ui = new AccountCreationOptions
                        {
                            CaptchaService = captcha,
                            Dob            = $"{random.Next(1970, 2000)}-{FormatPTCNumber(random.Next(1, 12))}-{FormatPTCNumber(random.Next(1, 27))}",
                            Proxy          = proxy.ToWebProxy(),
                            Username       = username,
                            Password       = password
                        };

                        var res = await Creator.Create(ui);

                        if (res.Successful)
                        {
                            Created++;
                            UpdateStats();
                            await Creator.HandleAccountAfterCreation(config, res);
                        }
                        else
                        {
                            Failed++;
                            UpdateStats();
                        }
                    }
                    BenchedProxies++;
                }));
            }

            // Go.
            await Task.WhenAll(tasks);
        }