public static string GetConfirmEmailContent(AccountEntity account) { string host = ""; int port = 0; getHostAndPortByEmail(account.emailAccount,ref host, ref port); if (host == "" || port == 0) { throw new Exception("未找到邮件服务器!"); } return FetchEmailHtmlBody.GetHtmlBody(host, port, account.emailAccount, account.emailPasswd); }
public static string GetConfirmLink(AccountEntity account) { string content = GetConfirmEmailContent(account); string[] lines = content.Split(new char[]{'\r','\n'}); content = ""; foreach (string line in lines) { string str = line.Trim(new char[] { '\t', ' ' }); content += str; } Regex reg = new Regex(Config.PATTERN_EMAIL_LINK,RegexOptions.Compiled); Match m = reg.Match(content); if (m == null) { throw new Exception("淘宝邮件确认连接地址未找到!"); } if (m.Groups.Count == 3) { return m.Groups[2].ToString(); } else return m.Groups[1].ToString(); }
public static List<AccountEntity> GetDatas() { List<AccountEntity> rntList = new List<AccountEntity>(); TxtFiles emailTxt = new TxtFiles(Config.PATH_OF_EMAILS); string[] allLines = emailTxt.ReadAllLines(); List<string> lineList = new List<string>(); foreach (string str in allLines) { if (lineList.Contains(str.Trim())) { continue; } string[] accounts = str.Split(new char[]{'|'}); if (accounts.Length != 2) { continue; } AccountEntity ae = new AccountEntity(); ae.emailAccount = accounts[0].Trim(); ae.emailPasswd = accounts[1].Trim(); rntList.Add(ae); lineList.Add(str.Trim()); } return rntList; }
public void Add(AccountEntity entity) { mEntities.Add(entity); }
private bool InitDriver(Object sender, Object param) { if (this.InvokeRequired) { this.Invoke(new AccessHandler(InitDriver),sender,param); } else { if (!entities.HasNext() && chHalfAuto.Checked == false) { OutMsg("重复使用失败的小号: " + failedEntity.Count.ToString()); if (chUseMode.Checked && failedEntity.Count > 0) { entities.Clear(); entities.AddList(failedEntity); failedEntity.Clear(); StreamWriter stream = new StreamWriter(@"失败小号.txt"); stream.WriteLine(); stream.Close(); } else { // OutPutFailedAndDeadAccount(); DumpAccount(); processControlor.Stop(); timer2.Stop(); return true; } } try { // 杀死进程 ProcessUtility.KillProcess("chromedriver"); ProcessUtility.KillProcess("chrome"); if (registerMode == 1) { curEntity = entities.Next(); } #region 初始化变量 registerMode = 1; isRegisterSuc = false; CUR_LOOP_CNT = 0; beginToClickClearBtn = false; statusBox.Clear(); emailRegisterCount = 0; #endregion CheckImageFactory.LoginAsyn(); var driverService = ChromeDriverService.CreateDefaultService(); driverService.HideCommandPromptWindow = true; int idx = RandomGenerator.getRandom().Next(devicesType.Count-1); string ios6ua = devicesType[idx]; ios6ua = "Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.3 (KHTML, like Gecko) Version/8.0 Mobile/12A4345d Safari/600.1.4"; ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.AddArgument("--user-agent=" + ios6ua); OutMsg("AGENT:" + ios6ua); if (chMode.Checked) { chromeOptions.AddArgument("-incognito"); } // FirefoxOptions firefoxOptions = new FirefoxOptions(); // firefoxOptions.ToCapabilities().("--user-agent=" + ios6ua); driver = new ChromeDriver(driverService, chromeOptions); driver.Manage().Cookies.DeleteAllCookies(); driver.Manage().Timeouts().SetPageLoadTimeout(new TimeSpan(0, 0, 10)); driver.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, 5)); if (!chMode.Checked) { driver.Manage().Window.Size = new System.Drawing.Size(500, driver.Manage().Window.Size.Height); } if (chMode.Checked) { driver.Navigate().GoToUrl("chrome://extensions-frame"); IWebElement checkbox = driver.FindElement(By.XPath("//*[@id=\"aapnijgdinlhnhlmodcfapnahmbfebeb\"]/div/div[1]/div[6]/div[1]/label/input")); if (!checkbox.Selected) { checkbox.Click(); } } // //reg.taobao.com/member/reg/h5/fill_email.htm driver.Navigate().GoToUrl("http://www.baidu.com"); // driver.Navigate().GoToUrl("https://login.taobao.com/member/login.jhtml?newMini=true&from=tmall-wap&redirectURL=https%3A%2F%2Fwww.tmall.com"); SMSProxy.InitInstance(AccountFactory.getInstance().getSMSAcc().UserName,AccountFactory.getInstance().getSMSAcc().Passwd, AccountFactory.getInstance().getSMSAcc().ProjID, AccountFactory.getInstance().getSMSAcc().PlatformName); SMSProxy.AsynLogin(); // 初始化dom位置 if (chHalfAuto.Checked) { GetDomPosition(); } } catch (System.Exception ex) { processControlor.GotoHanlderUnit("CloseDriver", 1000); } } return true; }
public static AccountEntity getTmpInstance() { AccountEntity ae = new AccountEntity(); ae.emailAccount = "*****@*****.**"; ae.emailPasswd = "123456flag"; return ae; }
private bool InitDriver(Object sender, Object param) { if (this.InvokeRequired) { this.Invoke(new AccessHandler(InitDriver),sender,param); } else { try { CheckImageFactory.LoginAsyn(); } catch (System.Exception ex) { OutMsg("登录图片验证码失败"); processControlor.Stop(); return true; } // 杀死进程 // ProcessUtility.KillProcess("chromedriver"); // ProcessUtility.KillProcess("chrome"); if (!entities.HasNext()) { loopTimes++; if (loopTimes >= GlobalSettings.getInstance().loopTimes) { timer2.Stop(); processControlor.Stop(); return true; } else { // 不是邮箱激活模式,才对失败的号进行重复激活 if (!cbEmailActivied.Checked) { entities.Clear(); entities.AddList(failedAccountList); failedAccountList.Clear(); } } } try { if (!entities.HasNext()) { OutMsg("没有可利用的邮箱"); processControlor.Stop(); return true; } if (registerMode == 1) { curEntity = entities.Next(); } #region 初始化变量 registerMode = 1; isRegisterSuc = false; statusBox.Clear(); #endregion //chromeOptions.AddArgument("--refer=" + ios6ua); // chromeOptions.AddArguments("--proxy-server="+proxyString); driver = GetChromeDriver(); driver.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, 10)); if (!chBrowserMode.Checked) { driver.Manage().Window.Size = new System.Drawing.Size(800, driver.Manage().Window.Size.Height); } if (chBrowserMode.Checked) { // driver.Navigate().GoToUrl("chrome://extensions-frame"); // IWebElement checkbox = driver.FindElement(By.XPath("//*[@id=\"aapnijgdinlhnhlmodcfapnahmbfebeb\"]/div/div[1]/div[6]/div[1]/label/input")); // if (!checkbox.Selected) // { // checkbox.Click(); // } } // //reg.taobao.com/member/reg/h5/fill_email.htm driver.Navigate().GoToUrl("https://memberprod.alipay.com/account/reg/enterpriseIndex.htm"); // driver.Navigate().GoToUrl("http://proxies.site-digger.com/proxy-detect/"); } catch (System.Exception ex) { processControlor.GotoHanlderUnit("CloseDriver", 1000); } } return true; }
// 输入确认信息,最后一步 public virtual bool InputConfirmInfo(ref AccountEntity ae) { return false; }
public override void PutLoginEmail(AccountEntity Ae) { onPutLoginEmailHandler(Ae); }
public override bool InputConfirmInfo(ref AccountEntity ae) { m_AE = ae; return onConfirmHandler(ref ae); // string pwd = RandomGenerator.getRandomPwd(); // ae.passwd = pwd; // HtmlElement element = Utiliy.GetHtmlElement(webBrowser, Config.CONFIRM_PASSWD1); // InputValue(element, pwd); // element = Utiliy.GetHtmlElement(webBrowser, Config.CONFIRM_PASSWD2); // InputValue(element, pwd); // // element = Utiliy.GetHtmlElement(webBrowser, Config.CONFIRM_NICKNAME); // string nickName = RandomGenerator.getRandomEnName(); // InputValue(element, nickName); // // element = Utiliy.GetHtmlElement(webBrowser, Config.CONFIRM_NICKNAME_CHECK); // while (element.Children[2].InnerText != null) // { // nickName = RandomGenerator.getRandomName(); // InputValue(element, nickName); // } // ae.acount = nickName; // element = Utiliy.GetHtmlElement(webBrowser, Config.CONFIRM_BUTTON); // element.InvokeMember("click"); //return false; }
//输入注册使用的邮箱 public virtual void PutLoginEmail(AccountEntity Ae) { }