Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using HtmlAgilityPack;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using OpenQA.Selenium;
- using OpenQA.Selenium.Chrome;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Net;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace TwitchAccountManager
- {
- public partial class frmAccountCreate : Form
- {
- delegate void StringArgReturningVoidDelegate(string text);
- List<BackgroundWorker> workers = new List<BackgroundWorker>();
- List<string> proxies = new List<string>(File.ReadAllLines("proxies.txt"));
- string[] adjectives = File.ReadAllLines("adjectives.txt");
- string[] nouns = File.ReadAllLines("nouns.txt");
- Queue<string> proxy_list = null;
- List<string> avaliable_usernames = new List<string>();
- bool generating_usernames = false;
- bool running = false;
- string api_key = "";
- Random rand = new Random();
- public frmAccountCreate()
- {
- InitializeComponent();
- }
- private void frmAccountCreate_Load(object sender, EventArgs e)
- {
- }
- private void btnStart_Click(object sender, EventArgs e)
- {
- running = true;
- txtStatus.Text = "Running";
- txtStatus.ForeColor = Color.Green;
- api_key = inputApiKey.Text;
- for (int i = 0; i < numThreads.Value; i++)
- {
- CreateWorker(0, "");
- }
- }
- private void CreateWorker(int delay, string name)
- {
- BackgroundWorker worker = new BackgroundWorker();
- worker.DoWork += (obj, e) => BackgroundWorker_DoWork(delay, name);
- worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BackgroundWorker_RunWorkerCompleted);
- worker.ProgressChanged += new ProgressChangedEventHandler(BackgroundWorker_ProgressChanged);
- worker.WorkerReportsProgress = true;
- worker.RunWorkerAsync();
- txtThreadCount.Text = (Int32.Parse(txtThreadCount.Text) + 1).ToString();
- }
- private void BackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
- {
- txtLog.Text = e.UserState as string + "\n";
- }
- private void btnStop_Click(object sender, EventArgs e)
- {
- running = false;
- txtStatus.Text = "Not Running";
- txtStatus.ForeColor = Color.Red;
- }
- private void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
- {
- txtThreadCount.Text = (Int32.Parse(txtThreadCount.Text) - 1).ToString();
- if (e.Error != null)
- {
- txtErrorCount.Text = (Int32.Parse(txtErrorCount.Text)+1).ToString();
- }
- else
- {
- txtAccountCount.Text = (Int32.Parse(txtAccountCount.Text) + 1).ToString();
- }
- if (running)
- CreateWorker(0, "");
- }
- private void BackgroundWorker_DoWork(int delay, string name)
- {
- //Stagger for CPU
- Thread.Sleep(delay);
- string username = "";
- if (name == "")
- username = GenerateUsername();
- else
- username = name;
- string password = GeneratePassword();
- int index = rand.Next(0, proxies.Count);
- if (proxy_list == null || proxy_list.Count == 0)
- proxy_list = new Queue<string>(proxies);
- string proxy_url = proxy_list.Dequeue();
- string key = "6Lcjjl8UAAAAAMCzOHbJj-yb2MBElPKqZmlE5bbL";
- string request1 = String.Format("http://2captcha.com/in.php?key={0}&method=userrecaptcha&googlekey={1}&pageurl={2}&json=1", api_key, key, "https://www.twitch.tv/signup");
- NoKeepAlivesWebClient client = new NoKeepAlivesWebClient();
- BetterWebClient email_client = new BetterWebClient();
- JObject result = JObject.Parse(client.DownloadString(request1));
- Thread.Sleep(25000);
- string id = result["request"].ToString();
- bool ready = false;
- string result_key = "";
- while (!ready)
- {
- string request2 = String.Format("http://2captcha.com/res.php?key={0}&action=get&id={1}&json=1", api_key, id);
- JObject result2 = JObject.Parse(client.DownloadString(request2));
- Console.WriteLine(result2);
- if (result2["request"].ToString() != "CAPCHA_NOT_READY")
- {
- ready = true;
- result_key = result2["request"].ToString();
- }
- Thread.Sleep(500);
- }
- //Dunno if all of these headers are needed, but doesn't hurt
- client.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36");
- client.Headers.Add("origin", "https://www.twitch.tv");
- client.Headers.Add("referer", "https://www.twitch.tv/directory");
- client.Headers.Add("accept", "*/*");
- client.Headers.Add("accept-encoding", "gzip, deflate, br");
- client.Headers.Add("accept-language", "en-US,en;q=0.9");
- WebProxy wp = new WebProxy(proxy_url.Split(':')[0], int.Parse(proxy_url.Split(':')[1]));
- client.Proxy = wp;
- email_client.Proxy = wp;
- string email_id = RandomString(10);
- JObject mail_details = JObject.Parse(email_client.DownloadString("http://api.guerrillamail.com/ajax.php?f=set_email_user&ip=127.0.0.1&agent=Mozilla_foo_bar&email_user=" + email_id));
- Payload payload = new Payload(username, password, mail_details["alias"].ToString() + "@pokemail.net", "kimne78kx3ncx6brgo4mv6wki5h1ko", new Birthday(rand.Next(1, 13), rand.Next(1, 20), rand.Next(1980,1995)), new Captcha(key, result_key));
- string json = JsonConvert.SerializeObject(payload, Formatting.None);
- try
- {
- string res = client.UploadString("https://passport.twitch.tv/register", json);
- JObject response = JObject.Parse(res);
- client.Headers.Add("Client-Id", "kimne78kx3ncx6brgo4mv6wki5h1ko");
- client.Headers.Add("Authorization", "OAuth " + response["access_token"].ToString());
- client.UploadString("https://gql.twitch.tv/gql", "[{\"operationName\":\"FollowButton_FollowUser\",\"variables\":{\"input\":{\"disableNotifications\":false,\"targetID\":\"71092938\"}},\"extensions\":{\"persistedQuery\":{\"version\":1,\"sha256Hash\":\"51956f0c469f54e60211ea4e6a34b597d45c1c37b9664d4b62096a1ac03be9e6\"}}}]");
- client.Headers.Add("Accept", "application/vnd.twitchtv.v5+json");
- JObject channel_info = JObject.Parse(client.DownloadString("https://api.twitch.tv/kraken/users?login=" + username));
- client.Headers.Remove("Accept");
- string channel_id = channel_info["users"][0]["_id"].ToString();
- File.AppendAllText("accounts.txt", username + "," + response["access_token"].ToString() + "," + password + "," + channel_id + "," + ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeSeconds() + Environment.NewLine);
- AppendLog("Created Account " + username);
- try
- {
- using (NoKeepAlivesWebClient client2 = new NoKeepAlivesWebClient())
- {
- client2.Proxy = wp;
- client2.Headers.Add("accept", "application/vnd.twitchtv.v5+json; charset=UTF-8");
- client2.Headers.Add("accept-encoding", "gzip, deflate, br");
- client2.Headers.Add("accept-language", "en-us");
- client2.Headers.Add("authorization", "OAuth " + response["access_token"].ToString());
- client2.Headers.Add("client-id", "kimne78kx3ncx6brgo4mv6wki5h1ko");
- client2.Headers.Add("content-type", "application/json; charset=UTF-8");
- client2.Headers.Add("origin", "https://www.twitch.tv");
- client2.Headers.Add("referer", "https://www.twitch.tv/settings/profile");
- client2.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36");
- client2.Headers.Add("x-requested-with", "XMLHttpRequest");
- string responsea = client2.UploadString("https://api.twitch.tv/kraken/users/" + channel_id, "PUT", "{\"displayname\":\"" + username + "\",\"description\":\"\",\"on_site\":1}");
- }
- }
- catch
- {
- }
- bool found_email = false;
- int counter = 0;
- while (!found_email && counter < 14)
- {
- JObject emails = JObject.Parse(email_client.DownloadString("http://api.guerrillamail.com/ajax.php?f=check_email&ip=127.0.0.1&agent=Mozilla_foo_bar&seq=0"));
- foreach (JToken email in emails["list"])
- {
- if (email["mail_from"].ToString().Contains("twitch.tv") && email["mail_subject"].ToString() == "Please verify your email address")
- {
- JObject email_content = JObject.Parse(email_client.DownloadString("http://api.guerrillamail.com/ajax.php?f=fetch_email&ip=127.0.0.1&agent=Mozilla_foo_bar&email_id=" + email["mail_id"].ToString()));
- HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument();
- htmlDocument.LoadHtml(email_content["mail_body"].ToString());
- foreach (HtmlNode link in htmlDocument.DocumentNode.SelectNodes("//a[@href]"))
- {
- HtmlAttribute att = link.Attributes["href"];
- if (att.Value.Contains("tt_content=email_verifier") && att.Value.Contains("email-verification"))
- {
- email_client.DownloadString(att.Value);
- int firstIndex = att.Value.IndexOf("email-verification/") + "email-verification/".Length;
- string token = att.Value.Substring(firstIndex, 32);
- client = new NoKeepAlivesWebClient();
- client.Proxy = wp;
- client.Headers.Add("accept", "application/vnd.twitchtv.v5+json; charset=UTF-8");
- client.Headers.Add("authorization", "OAuth " + response["access_token"].ToString());
- client.Headers.Add("client-id", "jzkbprff40iqj646a697cyrvl0zt2m6");
- client.Headers.Add("origin", "https://www.twitch.tv");
- client.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36");
- client.Headers.Add("x-requested-with", "XMLHttpRequest");
- client.UploadString("https://api.twitch.tv/v5/emailvalidator/" + token, "");
- AppendLog(username + " verified email");
- found_email = true;
- break;
- }
- }
- if (found_email)
- break;
- }
- }
- if (!found_email)
- Thread.Sleep(10000);
- counter++;
- }
- if (counter == 8 && !found_email)
- {
- File.AppendAllText("failed_emails.txt", username + Environment.NewLine);
- AppendLog(username + " failed to verify email");
- }
- }
- catch (WebException ex)
- {
- if (ex.Response != null)
- {
- var resp = new StreamReader(ex.Response.GetResponseStream()).ReadToEnd();
- AppendLog("ERROR! " + resp);
- if (resp.ToLower().Contains("blacklist") || resp.ToLower().Contains("throttle"))
- {
- proxies.RemoveAt(index);
- }
- }
- else
- {
- AppendLog("ERROR creating account");
- }
- throw new Exception("RIP");
- }
- }
- public bool isUsernameAvaliable(string username)
- {
- bool good_username = false;
- using (NoKeepAlivesWebClient username_client = new NoKeepAlivesWebClient())
- {
- username_client.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36");
- username_client.Headers.Add("origin", "https://www.twitch.tv");
- username_client.Headers.Add("referer", "https://www.twitch.tv/directory");
- username_client.Headers.Add("client-id", "kimne78kx3ncx6brgo4mv6wki5h1ko");
- username_client.Headers.Add("accept", "*/*");
- username_client.Headers.Add("accept-encoding", "gzip, deflate, br");
- username_client.Headers.Add("accept-language", "en-US,en;q=0.9");
- try
- {
- JObject response = JObject.Parse(username_client.UploadString("https://gql.twitch.tv/gql", "[{\"operationName\":\"UsernameValidator_User\",\"variables\":{\"username\":\"" + username + "\"},\"extensions\":{\"persistedQuery\":{\"version\":1,\"sha256Hash\":\"fd1085cf8350e309b725cf8ca91cd90cac03909a3edeeedbd0872ac912f3d660\"}}}]"));
- if (response["data"]["isUsernameAvailable"].ToString() == "true")
- {
- good_username = true;
- }
- }
- catch
- {
- //If fails just assume username is fine
- good_username = true;
- }
- }
- return good_username;
- }
- private string GenerateUsername()
- {
- if (avaliable_usernames.Count == 0)
- {
- if (generating_usernames)
- {
- Thread.Sleep(5000);
- return GenerateUsername();
- }
- //Let's get more usernames!
- generating_usernames = true;
- HtmlWeb web = new HtmlWeb();
- HtmlAgilityPack.HtmlDocument doc = web.Load("https://jimpix.co.uk/words/random-username-list.asp");
- foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//ul[@class='list-unstyled']/li"))
- {
- string username = node.GetAttributeValue("id", "error");
- if (username != "error")
- avaliable_usernames.Add(username);
- }
- generating_usernames = false;
- }
- string output = "";
- string seperator = "";
- string end = "";
- string beginning = "";
- int index = rand.Next(0, avaliable_usernames.Count);
- string first_part = avaliable_usernames[index].Split('.')[0];
- if (rand.Next(1, 3) == 2)
- first_part = Char.ToUpper(first_part[0]) + first_part.Substring(1);
- string second_part = avaliable_usernames[index].Split('.')[1];
- if (rand.Next(1,3) == 2 && Char.IsUpper(first_part[0]))
- second_part = Char.ToUpper(second_part[0]) + second_part.Substring(1);
- avaliable_usernames.RemoveAt(index);
- //Randomized pattern of usernames
- int choice = rand.Next(1, 12);
- if (choice == 1)
- seperator = "_";
- else if (choice > 1)
- seperator = "";
- choice = rand.Next(1, 9);
- if (choice == 1)
- beginning += (char)('a' + rand.Next(0,26));
- else if (choice > 1)
- {
- if (rand.Next(1, 30) == 1)
- beginning = "x";
- else
- beginning = "";
- }
- choice = rand.Next(1, 12);
- if (choice == 1)
- end = "_";
- else if (choice == 2)
- end += (char)('a' + rand.Next(0, 26));
- if (choice == 3)
- end = rand.Next(1,10).ToString();
- else if (choice > 3)
- {
- if (rand.Next(1, 20) == 1)
- end = "x";
- else
- end = "";
- }
- if (rand.Next(1, 30) == 29)
- second_part = second_part.ToUpper();
- output = beginning + first_part + seperator + second_part + end;
- var match = Regex.Match(output, @"^[a-zA-Z0-9_]{4,25}$", RegexOptions.IgnoreCase);
- if (!match.Success || !isUsernameAvaliable(output))
- return GenerateUsername();
- else
- {
- return output;
- }
- }
- private string GeneratePassword()
- {
- if (checkPassword.Checked && inputPassword.Text.Trim() != "")
- return inputPassword.Text.Trim();
- else
- return (adjectives[rand.Next(0, adjectives.Length)] + nouns[rand.Next(0, nouns.Length)] + rand.Next(0, 10) + rand.Next(0, 10)).Replace(" ", "");
- }
- public string RandomString(int length)
- {
- var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
- var stringChars = new char[8];
- for (int i = 0; i < stringChars.Length; i++)
- {
- stringChars[i] = chars[rand.Next(chars.Length)];
- }
- return new String(stringChars);
- }
- private void AppendLog(string text)
- {
- if (txtLog.InvokeRequired)
- {
- StringArgReturningVoidDelegate d = new StringArgReturningVoidDelegate(AppendLog);
- Invoke(d, new object[] { text });
- }
- else
- {
- txtLog.Text = txtLog.Text + text + "\n";
- }
- }
- private void txtLog_TextChanged(object sender, EventArgs e)
- {
- txtLog.ScrollToCaret();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- for (int i = 0; i < 10; i++)
- {
- AppendLog(GenerateUsername());
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- string name = Microsoft.VisualBasic.Interaction.InputBox("Prompt", "Name of account?", "", 100, 200).Trim();
- CreateWorker(0, name);
- }
- }
- public class Birthday
- {
- public Birthday(int Day, int Month, int Year)
- {
- day = Day;
- month = Month;
- year = Year;
- }
- public int day { get; set; }
- public int month { get; set; }
- public int year { get; set; }
- }
- public class Captcha
- {
- public Captcha(string Key, string Value)
- {
- key = Key;
- value = Value;
- }
- public string key { get; set; }
- public string value { get; set; }
- }
- public class Payload
- {
- public Payload(string Username, string Password, string Email, string Client_id, Birthday bd, Captcha cp)
- {
- username = Username;
- password = Password;
- email = Email;
- client_id = Client_id;
- birthday = bd;
- captcha = cp;
- }
- public string username { get; set; }
- public string password { get; set; }
- public string email { get; set; }
- public Birthday birthday { get; set; }
- public string client_id { get; set; }
- public Captcha captcha { get; set; }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement