public CaptchaResult SolveCaptcha() { CaptchaResult captchaID = this.GetCaptchaID(); bool flag = captchaID == null; CaptchaResult result; if (flag) { result = null; } else { Thread.Sleep(5000); result = this.PollCaptchaID(captchaID); } return(result); }
private CaptchaResult PollCaptchaID(CaptchaResult captchaId) { int maxPollTries = this.MaxPollTries; while (maxPollTries-- > 0) { try { using (WebClient webClient = new WebClient()) { string text = webClient.DownloadString(string.Format("{0}?key={1}&action=get&id={2}", "http://2captcha.com/res.php", this.APIKey, captchaId.ID)); bool flag = text.Contains("OK|"); if (flag) { captchaId.HasSolved = true; captchaId.Response = text.Split(new char[] { '|' })[1]; return(captchaId); } bool flag2 = text == "ERROR_CAPTCHA_UNSOLVABLE"; if (flag2) { return(captchaId); } } } catch (Exception arg) { Console.WriteLine("PollCaptchaID {0}: {1}", maxPollTries, arg); } Thread.Sleep(5000); } return(captchaId); }
private static async void CreateDiscordAccount(string proxyUrl, string email, string username, string password, string invonCreation = null) { try { string Fingermeprint = Program.GetFingerPrint(); WebProxy proxy = new WebProxy(proxyUrl, false) { UseDefaultCredentials = true }; HttpClient cl = null; HttpClientHandler httpClientHandler = new HttpClientHandler { Proxy = proxy, PreAuthenticate = true, UseDefaultCredentials = true }; cl = new HttpClient(httpClientHandler); cl.DefaultRequestHeaders.Clear(); cl.DefaultRequestHeaders.Add("Accept-Language", "en-US"); cl.DefaultRequestHeaders.Add("X-Fingerprint", string.Format("{0}", Fingermeprint)); Task <HttpResponseMessage> response = cl.PostAsync("https://discordapp.com/api/v6/auth/register", new StringContent(JsonConvert.SerializeObject(new Program.CreationStuff { fingerprint = string.Format("{0}", Fingermeprint), email = email, username = username, password = password, invite = invonCreation, consent = true, captcha_key = null }), Encoding.UTF8, "application/json")); Console.WriteLine("Sent request!"); bool flag = response.Result.StatusCode == HttpStatusCode.NoContent || response.Result.StatusCode == HttpStatusCode.OK; if (flag) { Console.WriteLine("-- " + response.Result.Content.ReadAsStringAsync().Result + string.Format(" -- ({0})", response.Result.StatusCode)); Console.WriteLine(string.Format("Successfully registered [{0}]{1}:{2}!", proxyUrl, email, password)); Task <HttpResponseMessage> responselol = cl.PostAsync("https://discordapp.com/api/auth/login", new StringContent(JsonConvert.SerializeObject(new Program.Login { email = email, password = password }), Encoding.UTF8, "application/json")); Program.TokenResponse resp = JsonConvert.DeserializeObject <Program.TokenResponse>(responselol.Result.Content.ReadAsStringAsync().Result); Console.WriteLine(string.Format("-- {0} --", resp.token)); cl.DefaultRequestHeaders.Add("Authorization", resp.token); Task <HttpResponseMessage> responsexd = cl.GetAsync("https://discordapp.com/api/v6/users/@me"); Program.GetDisCRIMINATOR discrim = JsonConvert.DeserializeObject <Program.GetDisCRIMINATOR>(responsexd.Result.Content.ReadAsStringAsync().Result); File.AppendAllText("Results.txt", string.Format("{0}:{1}:{2}", email, password, discrim.discriminator) + Environment.NewLine); File.AppendAllText("OutputTokens.txt", resp.token + "\n"); responselol = null; resp = null; responsexd = null; discrim = null; } else { TwoCaptcha solve = new TwoCaptcha(Config.TwoCaptchaKey, "6Lef5iQTAAAAAKeIvIY-DeexoO3gj7ryl9rLMEnn", "https://discordapp.com/api/v6/auth/register"); bool flag2 = response.Result.Content.ReadAsStringAsync().Result.Contains("captcha-required"); if (flag2) { Console.WriteLine(string.Format("[{0}/{1}/{2}]Captcha required, attempting to solve captcha...", proxyUrl, email, password)); solve.AccessProxy = proxy; CaptchaResult responsexd2 = solve.SolveCaptcha(); Console.WriteLine("g-recaptcha-response token: " + responsexd2.Response); await cl.PostAsync("https://discordapp.com/api/v6/auth/register", new StringContent(JsonConvert.SerializeObject(new Program.CreationStuff { fingerprint = string.Format("{0}", Fingermeprint), email = email, username = username, password = password, invite = invonCreation, consent = true, captcha_key = responsexd2.Response }), Encoding.UTF8, "application/json")); Console.WriteLine(string.Format("Successfully registered [{0}]{1}:{2}()!", proxyUrl, email, password)); Task <HttpResponseMessage> responselol2 = cl.PostAsync("https://discordapp.com/api/auth/login", new StringContent(JsonConvert.SerializeObject(new Program.Login { email = email, password = password }), Encoding.UTF8, "application/json")); Program.TokenResponse resp2 = JsonConvert.DeserializeObject <Program.TokenResponse>(responselol2.Result.Content.ReadAsStringAsync().Result); Console.WriteLine(string.Format("-- {0} --", resp2.token)); cl.DefaultRequestHeaders.Add("Authorization", resp2.token); Task <HttpResponseMessage> responsexdx = cl.GetAsync("https://discordapp.com/api/v6/users/@me"); Program.GetDisCRIMINATOR discrim2 = JsonConvert.DeserializeObject <Program.GetDisCRIMINATOR>(responsexdx.Result.Content.ReadAsStringAsync().Result); File.AppendAllText("Results.txt", string.Format("{0}:{1}:{2}", email, password, discrim2.discriminator) + Environment.NewLine); File.AppendAllText("OutputTokens.txt", resp2.token + "\n"); responsexd2 = null; responselol2 = null; resp2 = null; responsexdx = null; discrim2 = null; } else if (response.Result.Content.ReadAsStringAsync().Result.Contains("limited")) { Program.Error("Rate limited.REEEEEEEEEEEEEEEEEEEEEEE"); Thread.Sleep(35000); Console.WriteLine("ok, lets try again."); } else if (response.Result.Content.ReadAsStringAsync().Result.Contains("registered")) { Console.WriteLine("Email is registered REEEEEEEEEEEEEEEEE"); } solve = null; } Fingermeprint = null; proxy = null; cl = null; httpClientHandler = null; response = null; } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }