コード例 #1
0
        protected void GetCookiesAndSaveToDb(HyAccount account)
        {
            string str;

            Console.Title = string.Concat("取cookie ", Console.Title);
            string cookiesStr = SelementHelper.GetCookiesSmallStr(this.HySeleniumMgr.WebDriver);

            if ((cookiesStr != null ? cookiesStr.IndexOf("udb_biztoken") == -1 : false))
            {
                account.WebCookie = account.WebCookie ?? cookiesStr;
            }
            else
            {
                account.LoginSucceed = true;
                account.Uid          = HelperText.getMiddleStr(string.Concat(cookiesStr, ";"), "yyuid=", ";", 0).ToLong((long)0);
                string middleStr = HelperText.getMiddleStr(string.Concat(cookiesStr, ";"), "guid=", ";", 0);
                if (middleStr != null)
                {
                    str = middleStr.Trim();
                }
                else
                {
                    str = null;
                }
                account.Guid      = str ?? account.Guid;
                account.WebCookie = cookiesStr ?? account.WebCookie;
                XTrace.WriteLine(string.Concat(account.UserName, " ", account.UserPass, " 有登录成功状态"));
            }
            account.Save();
        }
コード例 #2
0
        // Token: 0x060000A1 RID: 161 RVA: 0x00006424 File Offset: 0x00004624
        private void InRoomGetGuid(HyAccount account)
        {
            this.Prepace(account);
            Console.Title = "到房间逛一下 " + Console.Title;
            base.OneByOneTaskTryErr(new Action <IWebDriver>(base.HySeleniumMgr.InRoom), base.HySeleniumMgr);
            Console.Title = "发送弹幕 " + Console.Title;
            base.OneByOneTaskTryErr(new Action <IWebDriver, string>(base.HySeleniumMgr.SendDanWu), base.HySeleniumMgr, "我来拉 6666");
            base.GetCookiesAndSaveToDb(account);
            string jqmStr = SelementHelper.GetJqmStr(base.HySeleniumMgr.WebDriver, Array.Empty <object>());

            XTrace.WriteLine("获取到的 机器码" + jqmStr);
            account.JiQiMa = (jqmStr ?? account.JiQiMa);
            account.Save();
        }
コード例 #3
0
        // Token: 0x0600009F RID: 159 RVA: 0x00005FBC File Offset: 0x000041BC
        private void ProcessOneZh(HyAccount account)
        {
            this.Prepace(account);
            base.ZHInitCaoZuo();
            Console.Title = "随机点击一个分类 " + Console.Title;
            base.OneByOneTaskTryErr(new Action <IWebDriver>(base.HySeleniumMgr.RandomOpenFeiLei), base.HySeleniumMgr);
            Console.Title = "到房间逛一下 " + Console.Title;
            base.OneByOneTaskTryErr(new Action <IWebDriver>(base.HySeleniumMgr.InRoom), base.HySeleniumMgr);
            Console.Title = "发送弹幕 " + Console.Title;
            base.OneByOneTaskTryErr(new Action <IWebDriver, string>(base.HySeleniumMgr.SendDanWu), base.HySeleniumMgr, "我来拉 6666");
            bool subscribe = XmlConfig <SeleniumConfig> .Current.Subscribe;

            if (subscribe)
            {
                Console.Title = "订阅 " + Console.Title;
                base.OneByOneTaskTryErr(new Action <IWebDriver>(base.HySeleniumMgr.Subscribe), base.HySeleniumMgr);
            }
            bool sendHyLiangGift = XmlConfig <SeleniumConfig> .Current.SendHyLiangGift;

            if (sendHyLiangGift)
            {
                Console.Title = "发送虎粮 " + Console.Title;
                base.OneByOneTaskTryErr(new Action <IWebDriver, int>(base.HySeleniumMgr.SendGift), base.HySeleniumMgr, 4);
            }
            bool lingTask = XmlConfig <SeleniumConfig> .Current.LingTask;

            if (lingTask)
            {
                Console.Title = "领任务 " + Console.Title;
                base.OneByOneTaskTryErr(new Action <IWebDriver>(base.HySeleniumMgr.TouXiangTask), base.HySeleniumMgr);
            }
            bool lingBaoXiang = XmlConfig <SeleniumConfig> .Current.LingBaoXiang;

            if (lingBaoXiang)
            {
                Console.Title = "领宝箱 " + Console.Title;
                base.OneByOneTaskTryErr(new Action <IWebDriver>(base.HySeleniumMgr.BaoXiangShow), base.HySeleniumMgr);
            }
            base.GetCookiesAndSaveToDb(account);
            string jqmStr = SelementHelper.GetJqmStr(base.HySeleniumMgr.WebDriver, Array.Empty <object>());

            XTrace.WriteLine("获取到的 机器码" + jqmStr);
            account.JiQiMa = (jqmStr ?? account.JiQiMa);
            account.Save();
        }
コード例 #4
0
        private bool OneReg()
        {
            bool flag;

            base.GeRegJqm();
            FiddlerHandle.AutoWeb.HySeleniumWeiBoRegMgr hySeleniumWeiBoRegMgr  = new FiddlerHandle.AutoWeb.HySeleniumWeiBoRegMgr();
            FiddlerHandle.AutoWeb.HySeleniumWeiBoRegMgr hySeleniumWeiBoRegMgr1 = hySeleniumWeiBoRegMgr;
            this.HySeleniumWeiBoRegMgr = hySeleniumWeiBoRegMgr;
            base.HySeleniumMgr         = hySeleniumWeiBoRegMgr1;
            MobileMgr   mobileMgr   = new MobileMgr(this.ptType);
            MobileModel mobileModel = mobileMgr.GetMobilenum(null);

            base.SetPhoneCodeCallBack(mobileMgr, mobileModel);
            base.HySeleniumMgr.ClearCach(mobileModel.PhoneNumber);
            string password = base.CratePasswor();
            bool   ret      = this.HySeleniumWeiBoRegMgr.WeiBoRegHy("", password, mobileModel.PhoneNumber, mobileModel.CountryCode);

            if (ret)
            {
                HyAccount zh = new HyAccount()
                {
                    UserName = mobileModel.PhoneNumber,
                    UserPass = password,
                    PiHao    = XmlConfig <SeleniumConfig> .Current.PiHao,
                    Enable   = true,
                    RegType  = RegType.Weibo,
                    BeiZhu   = "谷歌浏览器自动化操作微博注册"
                };
                zh.SaveModel(mobileModel);
                DateTime now = TimerX.Now;
                zh.CreateTime = now;
                string jqmStr = (string)SelementHelper.ExecJs(base.HySeleniumMgr.WebDriver, "return hyDecode(getCommmonInfo());", Array.Empty <object>());
                zh.JiQiMa     = jqmStr;
                zh.UpdateTime = now.AddDays(-1);
                zh.Save();
                flag = ret;
            }
            else
            {
                XTrace.WriteLine("注册失败");
                flag = false;
            }
            return(flag);
        }
コード例 #5
0
        public static string GetJqmStr(IWebDriver webDriver, params object[] args)
        {
            string str;

            try
            {
                webDriver.SwitchTo().DefaultContent();
                Thread.Sleep(1000);
                SelementHelper.ExecJs(webDriver, Resources.hydevice_8290851_Get, Array.Empty <object>());
                str = (string)SelementHelper.ExecJs(webDriver, "return getCommmonInfo2();", Array.Empty <object>());
                return(str);
            }
            catch (Exception exception)
            {
                Exception ex = exception;
                XTrace.WriteLine(string.Concat("执行脚本获取机器码信息出错 ", ex.Message, "   有可能时脚本还没初始化,执行流程不要太快"));
            }
            str = null;
            return(str);
        }
コード例 #6
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);
        }
コード例 #7
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());
            }
        }
コード例 #8
0
 public static void AddCookies(IWebDriver webDriver, string Coookie)
 {
     SelementHelper.AddCookies(webDriver, HttpHelper.StrCookieToCookieCollection(Coookie));
 }