Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using OpenQA.Selenium;
- using OpenQA.Selenium.Chrome;
- using OpenQA.Selenium.Support.UI;
- using System.Net.NetworkInformation;
- using System.IO;
- namespace RegisterBot
- {
- class Program
- {
- private static Random random = new Random();
- public static string RandomString(int length)
- {
- const string chars = "abcdefghijlmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
- return new string(Enumerable.Repeat(chars, length)
- .Select(s => s[random.Next(s.Length)]).ToArray());
- }
- static void Main(string[] args)
- {
- string RegisterPath;
- string ProxyPath;
- string OutputFile;
- if (System.Configuration.ConfigurationManager.AppSettings["RegisterPath"].Length > 0)
- {
- Console.WriteLine("TW Register Page path: " + System.Configuration.ConfigurationManager.AppSettings["RegisterPath"]);
- RegisterPath = System.Configuration.ConfigurationManager.AppSettings["RegisterPath"];
- }
- else {
- Console.Write("TW Register Page path: ");
- RegisterPath = Console.ReadLine();
- }
- if (System.Configuration.ConfigurationManager.AppSettings["ProxyPath"].Length > 0)
- {
- Console.WriteLine("HTTPS proxies file path: " + System.Configuration.ConfigurationManager.AppSettings["ProxyPath"]);
- ProxyPath = System.Configuration.ConfigurationManager.AppSettings["ProxyPath"];
- }
- else {
- Console.Write("HTTPS proxies file path: ");
- ProxyPath = Console.ReadLine();
- }
- if (System.Configuration.ConfigurationManager.AppSettings["OutputFile"].Length > 0)
- {
- Console.WriteLine("Output file path: " + System.Configuration.ConfigurationManager.AppSettings["OutputFile"]);
- OutputFile = System.Configuration.ConfigurationManager.AppSettings["OutputFile"];
- }
- else {
- Console.Write("Output file path: ");
- OutputFile = Console.ReadLine();
- }
- string TempMail = System.Configuration.ConfigurationManager.AppSettings["TempMail"];
- Console.WriteLine("Loading Proxies...");
- string[] lines = System.IO.File.ReadAllLines(ProxyPath);
- Console.WriteLine("Loaded " + lines.Length + " proxies.");
- foreach (string line in lines)
- {
- ChromeOptions options = new ChromeOptions();
- options.AddArguments("--proxy-server=http://" + line + "");
- var driver = new ChromeDriver(options);
- driver.Navigate().GoToUrl(TempMail);
- var Username = RandomString(16);
- var Password = RandomString(16);
- var Email = "";
- if (TempMail.Contains(driver.Title))
- {
- Console.WriteLine("Proxy: " + line + " timed out.");
- driver.Close();
- }
- else
- {
- Email = driver.FindElement(By.Id("mail")).GetAttribute("value");
- }
- driver.Navigate().GoToUrl(RegisterPath);
- if (RegisterPath.Contains(driver.Title))
- {
- Console.WriteLine("Proxy: " + line + " timed out.");
- driver.Close();
- }
- else
- {
- Console.WriteLine("Proxy: " + line + " connected.");
- System.IO.File.AppendAllText(OutputFile,Username + ":" + Password + Environment.NewLine);
- driver.FindElement(By.Id("register_username")).SendKeys(Username);
- driver.FindElement(By.Id("register_password")).SendKeys(Password);
- driver.FindElement(By.Id("register_email")).SendKeys(Email);
- string urlregist = driver.Url;
- driver.FindElement(By.Id("terms")).Click();
- driver.FindElement(By.ClassName("btn-register")).Click();
- while (driver.Url == urlregist)
- {
- System.Threading.Thread.Sleep(1000);
- }
- driver.Navigate().GoToUrl("https://temp-mail.org/");
- int iRowsCount = driver.FindElements(By.XPath("//table/tbody/tr/td/table/tbody/tr")).Count;
- while (iRowsCount == 0)
- {
- System.Threading.Thread.Sleep(1000);
- }
- driver.Navigate().GoToUrl(driver.FindElement(By.ClassName("title-subject")).GetAttribute("href"));
- driver.FindElements(By.XPath("//a[contains(@href,'/page/validate/')]"))
- }
- }
- Console.Write("Done.");
- Console.ReadLine();
- }
- }
- }
Add Comment
Please, Sign In to add comment