コード例 #1
0
        private void Process(int needCount)
        {
            int ZhiXingCount = 0;
            int SuccecdNum   = 0;

            FiddlerProxyLogic.SetFindderUseS5Proxy();
            while (true)
            {
                if (SuccecdNum >= needCount)
                {
                    break;
                }
                try
                {
                    try
                    {
                        if (XmlConfig <SeleniumConfig> .Current.ADSLBoHao)
                        {
                            XTrace.WriteLine(string.Concat(new string[] { "准备执行ADSL拨号...", XmlConfig <SeleniumConfig> .Current.PPPOEname, " ", XmlConfig <SeleniumConfig> .Current.PPOEZh, " ", XmlConfig <SeleniumConfig> .Current.PPOEMima, " ", XmlConfig <SeleniumConfig> .Current.FuWuName }));
                            ADSLx.ChongXinBoHao(XmlConfig <SeleniumConfig> .Current.PPPOEname, XmlConfig <SeleniumConfig> .Current.PPOEZh, XmlConfig <SeleniumConfig> .Current.PPOEMima, XmlConfig <SeleniumConfig> .Current.FuWuName, (string msg) => XTrace.WriteLine(string.Concat("执行ADSL拨号: [", XmlConfig <SeleniumConfig> .Current.PPPOEname, "] ->  ", msg)));
                        }
                        ZhiXingCount++;
                        Console.Title = string.Format("当前执行第[{0}]次 注册成功[{1}]个", ZhiXingCount, SuccecdNum);
                        XTrace.WriteLine(string.Format("执行次数 {0}", ZhiXingCount));
                        Action startAction = base.StartAction;
                        if (startAction != null)
                        {
                            startAction();
                        }
                        else
                        {
                        }
                        if (this.OneReg())
                        {
                            SuccecdNum++;
                        }
                    }
                    catch (Exception exception)
                    {
                        XTrace.WriteLine(string.Concat("执行任务过程出错 ", exception.ToString()));
                    }
                }
                finally
                {
                    base.Close();
                    Thread.Sleep(2000);
                    Action endAction = base.EndAction;
                    if (endAction != null)
                    {
                        endAction();
                    }
                    else
                    {
                    }
                    Thread.Sleep(3000);
                }
            }
            XTrace.WriteLine(string.Format("注册完成:总共数量 [{0}]", SuccecdNum));
        }
コード例 #2
0
        private bool OneReg()
        {
            bool flag;

            FiddlerProxyLogic.GetProxy(null);
            base.GeRegJqm();
            base.HySeleniumMgr = new FiddlerHandle.AutoWeb.HySeleniumMgr();
            MobileMgr   mobileMgr = new MobileMgr(this.ptType);
            MobileModel mobilenum = null;

            while (true)
            {
                mobilenum = mobileMgr.GetMobilenum(null);
                if ((mobilenum == null ? false : !mobilenum.PhoneNumber.IsNullOrWhiteSpace()))
                {
                    break;
                }
                XTrace.WriteLine("手机号码获取不到!~~");
            }
            ConvertMy.toInt(mobilenum.PhoneNumber.Cut(3, null));
            XTrace.WriteLine(string.Concat("合适的手机号码 ", mobilenum.PhoneNumber));
            HyAccount acount = HyAccount.FindByPhone(mobilenum.PhoneNumber);

            if ((acount == null ? true : acount.Phone.IsNullOrWhiteSpace()))
            {
                base.SetPhoneCodeCallBack(mobileMgr, mobilenum);
                base.HySeleniumMgr.ClearCach(mobilenum.PhoneNumber);
                string password = base.CratePasswor();
                bool   ret      = base.HySeleniumMgr.QuickRegisterHy(mobilenum.PhoneNumber, password, mobilenum.CountryCode);
                if (ret)
                {
                    HyAccount hyAccount = new HyAccount()
                    {
                        UserName = mobilenum.PhoneNumber,
                        UserPass = password,
                        PiHao    = XmlConfig <SeleniumConfig> .Current.PiHao,
                        Enable   = true,
                        RegType  = RegType.HyKuaiSu,
                        BeiZhu   = "测试第六批->www.huya.com 页面登录成功后自动弹出完善资料页面,谷歌浏览器自动化操作快速注册,过极验验证,过检测驱动"
                    };
                    hyAccount.SaveModel(mobilenum);
                    DateTime now = TimerX.Now;
                    hyAccount.CreateTime = now;
                    hyAccount.Save();
                    string jqmStr = SelementHelper.GetJqmStr(base.HySeleniumMgr.WebDriver, Array.Empty <object>());                   //机器码处理
                    hyAccount.JiQiMa     = jqmStr;
                    hyAccount.UpdateTime = now.AddDays(-1);
                    hyAccount.Save();
                    mobileMgr.reslut(mobilenum.PhoneNumber, true);
                    XTrace.WriteLine(string.Concat(new string[] { "快速注册成功 ", hyAccount.UserName, " 密码:", hyAccount.UserPass, "  还没登录信息,需要运行另一个任务取得登录信息" }));
                    base.HySeleniumMgr.GetPhoneSms = (string phone, string quHao) => {
                        string      str;
                        MobileModel mobe = mobileMgr.GetMobilenum(hyAccount.Phone);
                        if ((mobe == null ? false : !mobe.PhoneNumber.IsNullOrWhiteSpace()))
                        {
                            string sms = MobileMgr.GetYzm(mobileMgr.getVcodeAndHoldMobilenum(mobe), 6);
                            if (sms.IsNullOrWhiteSpace())
                            {
                                mobileMgr.cancelSMSRecv(mobilenum.PhoneNumber);
                            }
                            str = sms;
                        }
                        else
                        {
                            if ((mobe != null ? true : (mobe.Ex1.IsNullOrWhiteSpace() ? false : mobe.Ex1.IndexOf("没有可用号码") != -1)))
                            {
                                hyAccount.PhoneEx1 = mobe.Ex1;
                                hyAccount.Save();
                            }
                            str = null;
                        }
                        return(str);
                    };
                    try
                    {
                        int i = 0;
                        while (i < 5)
                        {
                            Thread.Sleep(5000);
                            base.HySeleniumMgr.WanShangZhiLiao(base.HySeleniumMgr.WebDriver);
                            if (!base.HySeleniumMgr.HasLogin(base.HySeleniumMgr.WebDriver))
                            {
                                base.HySeleniumMgr.LoginHy(hyAccount.UserName, hyAccount.UserPass, base.HySeleniumMgr.WebDriver);
                                i++;
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                    catch (Exception exception)
                    {
                        XTrace.WriteLine(string.Concat("执行登录出错 ", exception.ToString()));
                    }
                    base.ZHInitCaoZuo();
                    if (XmlConfig <SeleniumConfig> .Current.ZhuCeInRoom)
                    {
                        base.ZhuCeLoginAfter();
                    }
                    base.GetCookiesAndSaveToDb(hyAccount);
                    flag = ret;
                }
                else
                {
                    Thread.Sleep(900);
                    mobileMgr.GetMobilenum(mobilenum.PhoneNumber);
                    mobileMgr.addIgnoreList(mobilenum);
                    mobileMgr.cancelSMSRecv(mobilenum.PhoneNumber);
                    XTrace.WriteLine("注册失败");
                    mobileMgr.reslut(mobilenum.PhoneNumber, false);
                    string jqmStr1 = SelementHelper.GetJqmStr(base.HySeleniumMgr.WebDriver, Array.Empty <object>());
                    XTrace.WriteLine(string.Concat("测试 获取到的机器码为 ", jqmStr1));
                    flag = false;
                }
            }
            else
            {
                mobileMgr.addIgnoreList(mobilenum);
                mobileMgr.cancelSMSRecv(mobilenum.PhoneNumber);
                XTrace.WriteLine("手机号码已经注册!~~");
                mobileMgr.reslut(mobilenum.PhoneNumber, false);
                flag = false;
            }
            return(flag);
        }
コード例 #3
0
        // Token: 0x0600009E RID: 158 RVA: 0x00005BC0 File Offset: 0x00003DC0
        private void Process()
        {
            int  ZhiXingCount        = 0;
            bool isLogin             = XmlConfig <SeleniumConfig> .Current.IsLogin;
            IList <HyAccount> zhs    = HyAccount.GetHyAccountsByRegType(RegType.HyKuaiSu, XmlConfig <SeleniumConfig> .Current.PiHao, isLogin);
            IList <HyAccount> adds   = HyAccount.GetHyAccountsByRegType(RegType.SMS, XmlConfig <SeleniumConfig> .Current.PiHao, isLogin);
            List <HyAccount>  AllZhs = new List <HyAccount>();

            AllZhs.AddRange(zhs);
            AllZhs.AddRange(adds);
            int oneDaySeconds = 86400;

            FiddlerProxyLogic.SetFindderUseS5Proxy();
            foreach (HyAccount item in AllZhs)
            {
                DateTime now  = TimerX.Now;
                bool     flag = (now - item.UpdateTime).TotalSeconds < (double)oneDaySeconds;
                if (flag)
                {
                    XTrace.WriteLine("账号[" + item.UserName + "]上次操作间隔时间还没有24小时");
                }
                try
                {
                    bool adslboHao = XmlConfig <SeleniumConfig> .Current.ADSLBoHao;
                    if (adslboHao)
                    {
                        XTrace.WriteLine(string.Concat(new string[]
                        {
                            "准备执行ADSL拨号...",
                            XmlConfig <SeleniumConfig> .Current.PPPOEname,
                            " ",
                            XmlConfig <SeleniumConfig> .Current.PPOEZh,
                            " ",
                            XmlConfig <SeleniumConfig> .Current.PPOEMima,
                            " ",
                            XmlConfig <SeleniumConfig> .Current.FuWuName
                        }));
                        ADSLx.ChongXinBoHao(XmlConfig <SeleniumConfig> .Current.PPPOEname, XmlConfig <SeleniumConfig> .Current.PPOEZh, XmlConfig <SeleniumConfig> .Current.PPOEMima, XmlConfig <SeleniumConfig> .Current.FuWuName, delegate(string msg)
                        {
                            XTrace.WriteLine("执行ADSL拨号: [" + XmlConfig <SeleniumConfig> .Current.PPPOEname + "] ->  " + msg);
                        });
                    }
                    ZhiXingCount++;
                    Console.Title = string.Format("当前执行第[{0}]次 ", ZhiXingCount);
                    XTrace.WriteLine(string.Format("执行次数 {0}", ZhiXingCount));
                    Action startAction = base.StartAction;
                    if (startAction != null)
                    {
                        startAction();
                    }
                    this.ProcessOneZh(item);
                    bool test = XmlConfig <SeleniumConfig> .Current.Test;
                    if (test)
                    {
                        XTrace.WriteLine("测试模式,已退出流程!");
                        return;
                    }
                }
                catch (Exception ex)
                {
                    XTrace.WriteLine("执行任务过程出错 " + ex.ToString());
                }
                finally
                {
                    base.Close();
                    Thread.Sleep(2000);
                    Action endAction = base.EndAction;
                    if (endAction != null)
                    {
                        endAction();
                    }
                    Thread.Sleep(3000);
                }
            }
            XTrace.WriteLine("再次检测没有guid的,再进行一次操作");
            bool hasCaozuo = false;

            for (int i = 0; i < 3; i++)
            {
                foreach (HyAccount item2 in AllZhs)
                {
                    try
                    {
                        bool flag2 = string.IsNullOrWhiteSpace(item2.Guid);
                        if (flag2)
                        {
                            hasCaozuo = true;
                            this.InRoomGetGuid(item2);
                        }
                    }
                    catch (Exception ex2)
                    {
                        XTrace.WriteLine("再次检测没有guid的 执行任务过程出错 " + ex2.ToString());
                    }
                    finally
                    {
                        bool flag3 = hasCaozuo;
                        if (flag3)
                        {
                            base.Close();
                            Thread.Sleep(2000);
                            Action endAction2 = base.EndAction;
                            if (endAction2 != null)
                            {
                                endAction2();
                            }
                            Thread.Sleep(3000);
                        }
                    }
                    hasCaozuo = false;
                }
                Thread.Sleep(10000);
            }
            XTrace.WriteLine("全部任务运行完成");
        }
コード例 #4
0
        // Token: 0x060000A0 RID: 160 RVA: 0x000061D0 File Offset: 0x000043D0
        private void Prepace(HyAccount account)
        {
            FiddlerProxyLogic.GetProxy(null);
            bool flag = !account.JiQiMa.IsNullOrWhiteSpace();

            if (flag)
            {
                JiQiMa jqm = new JiQiMa();
                jqm.SetVal4ComOldJson(account.JiQiMa);
                HookMgr.jiQiMa = jqm;
            }
            string zh   = account.UserName;
            string mima = account.UserPass;

            Console.Title = string.Concat(new string[]
            {
                "当前账号 [",
                zh,
                "] [",
                mima,
                "] ",
                Console.Title
            });
            base.HySeleniumMgr             = new HySeleniumMgr();
            base.HySeleniumMgr.GetPhoneSms = delegate(string phone, string quHao)
            {
                bool   phoneSmsShouDong = XmlConfig <SeleniumConfig> .Current.PhoneSmsShouDong;
                string result;
                if (phoneSmsShouDong)
                {
                    string sm = DataFile.WtingRead("请输入手机号 [" + phone + "]的验证码", "你输入的手机号 [{phone}]的验证码是", delegate(string s)
                    {
                        bool flag7 = s.Length == 6;
                        return(!flag7);
                    });
                    result = sm;
                }
                else
                {
                    MobileType  ptType    = MobileTypeTool.Ex2ToMobileType(account.PhoneEx2);
                    MobileMgr   MobileMgr = new MobileMgr(ptType);
                    MobileModel mobe      = MobileMgr.GetMobilenum(account.Phone);
                    bool        flag4     = mobe == null || mobe.PhoneNumber.IsNullOrWhiteSpace();
                    if (flag4)
                    {
                        bool flag5 = mobe != null || (!mobe.Ex1.IsNullOrWhiteSpace() && mobe.Ex1.IndexOf("没有可用号码") != -1);
                        if (flag5)
                        {
                            account.PhoneEx1 = mobe.Ex1;
                            account.Save();
                        }
                        result = null;
                    }
                    else
                    {
                        string smsBody = MobileMgr.getVcodeAndHoldMobilenum(mobe);
                        string sms     = MobileMgr.GetYzm(smsBody, 6);
                        bool   flag6   = sms.IsNullOrWhiteSpace();
                        if (flag6)
                        {
                            MobileMgr.cancelSMSRecv(mobe.PhoneNumber);
                        }
                        result = sms;
                    }
                }
                return(result);
            };
            bool flag2;

            if (XmlConfig <SeleniumConfig> .Current.UpCookie && !account.WebCookie.IsNullOrWhiteSpace())
            {
                string webCookie = account.WebCookie;
                flag2 = (webCookie == null || webCookie.IndexOf("udb_biztoken") != -1);
            }
            else
            {
                flag2 = false;
            }
            bool flag3 = flag2;

            if (flag3)
            {
                XTrace.WriteLine("修改cookie 为: " + account.WebCookie);
                HookMgr.curCookie = account.WebCookie;
                HookMgr.UpCookie  = XmlConfig <SeleniumConfig> .Current.UpCookie;
                try
                {
                    IWebDriver webDriver = base.HySeleniumMgr.OpenFirst(zh, XmlConfig <SeleniumConfig> .Current.FirstUrl, "127.0.0.1:8877");
                    SelementHelper.AddCookies(webDriver, account.WebCookie);
                    Thread.Sleep(500);
                }
                catch (Exception ex)
                {
                    XTrace.WriteLine("修改cookie失败 " + ex.ToString());
                    Thread.Sleep(10000);
                    return;
                }
                finally
                {
                    base.Close();
                    HookMgr.curCookie = null;
                    HookMgr.UpCookie  = false;
                }
            }
            try
            {
                IWebDriver webDriver2 = base.HySeleniumMgr.OpenFirst(zh, XmlConfig <SeleniumConfig> .Current.FirstUrl, "127.0.0.1:8877");
                base.HySeleniumMgr.LoginHy(zh, mima, webDriver2);
            }
            catch (Exception ex2)
            {
                XTrace.WriteLine("登录虎牙账号出错 " + ex2.ToString());
            }
        }