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(); }
private void Process() { string txtPath = XmlConfig <SeleniumConfig> .Current.ZhangHaoTxtPath; string[] lines = DataFile.ReadLines(txtPath); XTrace.WriteLine(string.Concat("读入账号文本路径", txtPath)); int i = 0; string[] strArrays = lines; for (int num = 0; num < (int)strArrays.Length; num++) { string item = strArrays[num]; string[] line = item.Split(new string[] { "----" }, StringSplitOptions.RemoveEmptyEntries); if ((int)line.Length > 1) { HyAccount data = HyAccount.FindByUserName(line[0]) ?? new HyAccount(); data.UserName = line[0]; data.UserPass = line[1]; data.Phone = line[2]; data.PiHao = XmlConfig <SeleniumConfig> .Current.PiHao; data.Enable = true; data.Save(); XTrace.WriteLine(string.Format("文本保存导入到数据库完成 导入 {0}", line)); i++; } } XTrace.WriteLine(string.Format("文本保存导入到数据库完成 导入[{0}]个 完成", i)); }
// 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(); }
// 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(); }
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); }
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); }
// 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("全部任务运行完成"); }
// 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()); } }