SHARE
TWEET

Untitled

a guest Oct 4th, 2017 22 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using OpenQA.Selenium;
  7. using OpenQA.Selenium.Chrome;
  8. using OpenQA.Selenium.Support.UI;
  9. using System.Net.NetworkInformation;
  10. using System.IO;
  11.  
  12. namespace RegisterBot
  13. {
  14.     class Program
  15.     {
  16.         private static Random random = new Random();
  17.         public static string RandomString(int length)
  18.         {
  19.             const string chars = "abcdefghijlmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
  20.             return new string(Enumerable.Repeat(chars, length)
  21.               .Select(s => s[random.Next(s.Length)]).ToArray());
  22.         }
  23.         static void Main(string[] args)
  24.         {
  25.             string RegisterPath;
  26.             string ProxyPath;
  27.             string OutputFile;
  28.             if (System.Configuration.ConfigurationManager.AppSettings["RegisterPath"].Length > 0)
  29.             {
  30.                 Console.WriteLine("TW Register Page path: " + System.Configuration.ConfigurationManager.AppSettings["RegisterPath"]);
  31.                 RegisterPath = System.Configuration.ConfigurationManager.AppSettings["RegisterPath"];
  32.             }
  33.             else {
  34.                 Console.Write("TW Register Page path: ");
  35.                 RegisterPath = Console.ReadLine();
  36.             }
  37.             if (System.Configuration.ConfigurationManager.AppSettings["ProxyPath"].Length > 0)
  38.             {
  39.                 Console.WriteLine("HTTPS proxies file path: " + System.Configuration.ConfigurationManager.AppSettings["ProxyPath"]);
  40.                 ProxyPath = System.Configuration.ConfigurationManager.AppSettings["ProxyPath"];
  41.             }
  42.             else {
  43.                 Console.Write("HTTPS proxies file path: ");
  44.                 ProxyPath = Console.ReadLine();
  45.             }
  46.             if (System.Configuration.ConfigurationManager.AppSettings["OutputFile"].Length > 0)
  47.             {
  48.                 Console.WriteLine("Output file path: " + System.Configuration.ConfigurationManager.AppSettings["OutputFile"]);
  49.                 OutputFile = System.Configuration.ConfigurationManager.AppSettings["OutputFile"];
  50.             }
  51.             else {
  52.                 Console.Write("Output file path: ");
  53.                 OutputFile = Console.ReadLine();
  54.             }
  55.             string TempMail = System.Configuration.ConfigurationManager.AppSettings["TempMail"];
  56.             Console.WriteLine("Loading Proxies...");
  57.             string[] lines = System.IO.File.ReadAllLines(ProxyPath);
  58.             Console.WriteLine("Loaded " + lines.Length + " proxies.");
  59.             foreach (string line in lines)
  60.             {
  61.                 ChromeOptions options = new ChromeOptions();
  62.                 options.AddArguments("--proxy-server=http://" + line + "");
  63.                 var driver = new ChromeDriver(options);
  64.                 driver.Navigate().GoToUrl(TempMail);
  65.                 var Username = RandomString(16);
  66.                 var Password = RandomString(16);
  67.                 var Email = "";
  68.                 if (TempMail.Contains(driver.Title))
  69.                 {
  70.                     Console.WriteLine("Proxy: " + line + " timed out.");
  71.                     driver.Close();
  72.                 }
  73.                 else
  74.                 {
  75.                     Email = driver.FindElement(By.Id("mail")).GetAttribute("value");
  76.                 }  
  77.                 driver.Navigate().GoToUrl(RegisterPath);
  78.                 if (RegisterPath.Contains(driver.Title))
  79.                 {
  80.                     Console.WriteLine("Proxy: " + line + " timed out.");
  81.                     driver.Close();
  82.                 }
  83.                 else
  84.                 {
  85.                     Console.WriteLine("Proxy: " + line + " connected.");
  86.                     System.IO.File.AppendAllText(OutputFile,Username + ":" + Password + Environment.NewLine);
  87.                     driver.FindElement(By.Id("register_username")).SendKeys(Username);
  88.                     driver.FindElement(By.Id("register_password")).SendKeys(Password);
  89.                     driver.FindElement(By.Id("register_email")).SendKeys(Email);
  90.                     string urlregist = driver.Url;
  91.                     driver.FindElement(By.Id("terms")).Click();
  92.                     driver.FindElement(By.ClassName("btn-register")).Click();
  93.                     while (driver.Url == urlregist)
  94.                     {
  95.                         System.Threading.Thread.Sleep(1000);
  96.                     }
  97.                     driver.Navigate().GoToUrl("https://temp-mail.org/");
  98.                     int iRowsCount = driver.FindElements(By.XPath("//table/tbody/tr/td/table/tbody/tr")).Count;
  99.                     while (iRowsCount == 0)
  100.                     {
  101.                         System.Threading.Thread.Sleep(1000);
  102.                     }
  103.                     driver.Navigate().GoToUrl(driver.FindElement(By.ClassName("title-subject")).GetAttribute("href"));
  104.                     driver.FindElements(By.XPath("//a[contains(@href,'/page/validate/')]"))
  105.  
  106.                 }
  107.  
  108.             }
  109.             Console.Write("Done.");
  110.             Console.ReadLine();
  111.         }
  112.     }
  113. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top