コード例 #1
0
        public EmailService()
        {
            Inbox = new List <Email> ();

            _mailbox = new GuerrillaMail();
            _mailbox.GetEmailAddress();
        }
コード例 #2
0
        public static List <GuerrillaMail.Email> WaitEmail(this GuerrillaMail Email, Func <GuerrillaMail.Email, bool> Verify = null, int WaitMin = 10)
        {
            var Mails = new List <GuerrillaMail.Email>();

            DateTime Limit = DateTime.Now.AddMinutes(WaitMin);

            while (Mails.Count == 0)
            {
                ThreadTools.Wait(10000, true);
                if (DateTime.Now > Limit)
                {
                    throw new Exception("Timeout");
                }

                if (Verify == null)
                {
                    Mails = Email.GetAllEmails();
                }
                else
                {
                    Mails = Email.GetAllEmails().Where(Verify).ToList();
                }
            }

            return(Mails);
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: Burstvn/selenium_recaptcha
        public void chrome(int ii)
        {
            GuerrillaMail guerrilla = new GuerrillaMail();

            guerrilla.GetEmailAddress();



            Random number     = new Random();
            string sdt        = "09" + number.Next(10000000, 99999999);
            string passrandom = NgauNhienName().ToLower() + number.Next(10000, 99999) + "@";
            string mail       = guerrilla.EmailAddress;
            string ggkey      = "6LdKwvcUAAAAAOWHayxQNHnDrDVL6GWC-lx1EP0R";
            string CaptchaURL = "https://neebanker.neebank.com/auth/signup?ref=bootm4v";
            var    usename    = NgauNhienName() + number.Next(0, 999999) + ii;
            var    email      = guerrilla.EmailAddress;



            ChromeDriverService service = ChromeDriverService.CreateDefaultService();

            service.HideCommandPromptWindow = true;

            //var options = new ChromeOptions();
            //options.AddArgument("--start - maximized");

            var chromeDriver = new ChromeDriver(service);

            chromeDriver.Url = textBox1.Text;
            chromeDriver.Navigate();
            try
            {
                Thread.Sleep(10000);
                chromeDriver.FindElementByCssSelector("#id_username").SendKeys(usename);
            }
            catch
            {
                chromeDriver.Navigate().Refresh();
                chromeDriver.FindElementByCssSelector("#id_username").SendKeys(usename);;
            }
            string captchaOut = Reslove2CaptchaCaptcha(textBox5.Text, ggkey, CaptchaURL);

            chromeDriver.FindElementByCssSelector("#CountryCode > option:nth-child(233)").Click();
            chromeDriver.FindElementByCssSelector("#userPhone").SendKeys(sdt);
            chromeDriver.FindElementByCssSelector("#id_email").SendKeys(email);
            chromeDriver.FindElementByCssSelector("#id_password1").SendKeys(passrandom);
            chromeDriver.FindElementByCssSelector("#id_password2").SendKeys(passrandom);
            chromeDriver.FindElementByCssSelector("#signupform > div.form-group > div.custom-control.custom-checkbox.d-flex.justify-content-start.text-white > label").Click();

            chromeDriver.ExecuteScript("document.getElementById(\"g-recaptcha-response\").innerHTML=\"" + captchaOut + "\"");
            chromeDriver.FindElementByCssSelector("#signup-btn > span").Click();
            Thread.Sleep(15000);
            chromeDriver.ExecuteScript("document.getElementsByClassName('confirm btn btn-lg btn-success')[0].click();");

            //chromeDriver.FindElementByCssSelector("body > div.sweet-alert.showSweetAlert.visible > div.sa-button-container > div > button").Click();



            guerrilla.CheckEmail();



            if (guerrilla.EmailCount == 0)
            {
                Thread.Sleep(15000);
                guerrilla.CheckEmail();
                if (guerrilla.EmailCount == 0)
                {
                    guerrilla.CheckEmail();
                    Thread.Sleep(15000);
                    guerrilla.CheckEmail();
                }
            }
            if (guerrilla.EmailCount > 0)
            {
                Email emails = guerrilla.FetchEmail(guerrilla.Emails[0].MailId);

                string url   = emails.MailBody;
                var    aaaa2 = url.Substring(url.IndexOf("bold"), 13);
                Thread.Sleep(3000);
                var code = aaaa2.Split('>')[1];
                chromeDriver.FindElementByCssSelector("#TwoFaCode").SendKeys(code);
                chromeDriver.FindElementByCssSelector("#otp-activation-btn").Click();
                Thread.Sleep(3000);
            }
        }
コード例 #4
0
 public static void ClearEmail(this GuerrillaMail Email, bool Wait = false)
 {
     Email.DeleteEmails((from x in Wait ? Email.WaitEmail() : Email.GetAllEmails() select x.mail_id.ToString()));
 }